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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7046405420ae2d8a151d553ced94b3545bdf702 | 1,204 | py | Python | Flask Server.py | Dropout1337/HWID-Authentication-API | f13c43bd2eba67b54c6902506c37cfc838400690 | [
"MIT"
] | 5 | 2020-10-26T08:37:19.000Z | 2021-07-19T20:05:52.000Z | Flask Server.py | bryonpokemon/HWID-Authentication-API | f13c43bd2eba67b54c6902506c37cfc838400690 | [
"MIT"
] | null | null | null | Flask Server.py | bryonpokemon/HWID-Authentication-API | f13c43bd2eba67b54c6902506c37cfc838400690 | [
"MIT"
] | 2 | 2021-02-11T16:13:04.000Z | 2021-02-23T05:38:41.000Z | import sqlite3
from flask import Flask, jsonify, request
app = Flask(__name__)
app.debug = True
api_key = "RANDOM ACCESS KEY HERE"
def CheckAPIKey(key):
if key == api_key:
return True
else:
return False
@app.route('/')
def HomeDir():
return jsonify({'msg': "invalid_endpoi... | 25.617021 | 62 | 0.549003 | import sqlite3
from flask import Flask, jsonify, request
app = Flask(__name__)
app.debug = True
api_key = "RANDOM ACCESS KEY HERE"
def CheckAPIKey(key):
if key == api_key:
return True
else:
return False
@app.route('/')
def HomeDir():
return jsonify({'msg': "invalid_endpoi... | true | true |
f70465ab09b7e3a8258fdf6aa11efa736b8d375d | 3,704 | py | Python | tfs_utils.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | tfs_utils.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | tfs_utils.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | import os
import shutil
import subprocess
from pathlib import Path
from dotenv import dotenv_values
COMPOSAPY_ROOT_DIR = Path(__file__).parent
COMP_APP_PROD_DIR = COMPOSAPY_ROOT_DIR.parent.parent.joinpath("Product")
DATALAB_SERVICE_STATIC_DIR = COMP_APP_PROD_DIR.joinpath(
"CompAnalytics.DataLabService", "static"
)... | 32.778761 | 90 | 0.661177 | import os
import shutil
import subprocess
from pathlib import Path
from dotenv import dotenv_values
COMPOSAPY_ROOT_DIR = Path(__file__).parent
COMP_APP_PROD_DIR = COMPOSAPY_ROOT_DIR.parent.parent.joinpath("Product")
DATALAB_SERVICE_STATIC_DIR = COMP_APP_PROD_DIR.joinpath(
"CompAnalytics.DataLabService", "static"
)... | true | true |
f70467818a94eecac2a270341b4fa3d8b8a2193e | 5,565 | py | Python | sympy/functions/special/tests/test_gamma_functions.py | jegerjensen/sympy | 3a43310f1957a21a6f095fe2801cc05b5268a2c7 | [
"BSD-3-Clause"
] | 1 | 2016-07-13T04:30:25.000Z | 2016-07-13T04:30:25.000Z | sympy/functions/special/tests/test_gamma_functions.py | jegerjensen/sympy | 3a43310f1957a21a6f095fe2801cc05b5268a2c7 | [
"BSD-3-Clause"
] | null | null | null | sympy/functions/special/tests/test_gamma_functions.py | jegerjensen/sympy | 3a43310f1957a21a6f095fe2801cc05b5268a2c7 | [
"BSD-3-Clause"
] | null | null | null | from sympy import Symbol, gamma, oo, nan, zoo, factorial, sqrt, Rational, log,\
polygamma, EulerGamma, pi, uppergamma, S, expand_func, loggamma, sin, cos, \
O, cancel
x = Symbol('x')
y = Symbol('y')
n = Symbol('n', integer=True)
def test_gamma():
assert gamma(nan) == nan
assert gamma(oo) == oo... | 36.372549 | 84 | 0.533513 | from sympy import Symbol, gamma, oo, nan, zoo, factorial, sqrt, Rational, log,\
polygamma, EulerGamma, pi, uppergamma, S, expand_func, loggamma, sin, cos, \
O, cancel
x = Symbol('x')
y = Symbol('y')
n = Symbol('n', integer=True)
def test_gamma():
assert gamma(nan) == nan
assert gamma(oo) == oo... | true | true |
f7046789ac98fa4ab8bea3ee65dae91d7e9edde9 | 1,413 | py | Python | search_engine/pods/splitter.py | Alea4jacta6est/transformers-for-lawyers | 3a4888617b89b4ae0fddb4cb69e924106eaea4cd | [
"Apache-2.0"
] | null | null | null | search_engine/pods/splitter.py | Alea4jacta6est/transformers-for-lawyers | 3a4888617b89b4ae0fddb4cb69e924106eaea4cd | [
"Apache-2.0"
] | null | null | null | search_engine/pods/splitter.py | Alea4jacta6est/transformers-for-lawyers | 3a4888617b89b4ae0fddb4cb69e924106eaea4cd | [
"Apache-2.0"
] | null | null | null | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from typing import Dict
import re
import string
from jina.hub.crafters.nlp.Sentencizer import Sentencizer
import pickle
# class Splitter(Sentencizer):
# count = 0
# separator = "|"
#
# def __init__(self,... | 30.06383 | 78 | 0.551309 | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from typing import Dict
import re
import string
from jina.hub.crafters.nlp.Sentencizer import Sentencizer
import pickle
class SentenceSplitter(Sentencizer):
count = 0
separator = "|"
def __i... | true | true |
f70467b0bd0971bb7dfa116b96c50c60140e0b94 | 8,598 | py | Python | apps/jetbrains/jetbrains.py | SeanTaylorLane/knausj_talon | 26ea2a9078a3dff4e0941293b4c70e40b849aa1a | [
"MIT"
] | 2 | 2021-02-10T00:06:28.000Z | 2021-03-19T22:12:54.000Z | apps/jetbrains/jetbrains.py | SeanTaylorLane/knausj_talon | 26ea2a9078a3dff4e0941293b4c70e40b849aa1a | [
"MIT"
] | null | null | null | apps/jetbrains/jetbrains.py | SeanTaylorLane/knausj_talon | 26ea2a9078a3dff4e0941293b4c70e40b849aa1a | [
"MIT"
] | null | null | null | import os
import os.path
import requests
import time
from pathlib import Path
from talon import ctrl, ui, Module, Context, actions, clip
import tempfile
# Courtesy of https://github.com/anonfunc/talon-user/blob/master/apps/jetbrains.py
extendCommands = []
# Each IDE gets its own port, as otherwise you wouldn't be ab... | 28.098039 | 87 | 0.646778 | import os
import os.path
import requests
import time
from pathlib import Path
from talon import ctrl, ui, Module, Context, actions, clip
import tempfile
extendCommands = []
# to run two at the same time and switch between them.
# Note that MPS and IntelliJ ultimate will conflict...
port_mapping = {
"com.google... | true | true |
f704685df711b41023f741190aba21f6adde2272 | 1,194 | py | Python | docs/_downloads/e0051c6e37b730111a06abd85529e288/plot__2d_distributions.py | IKupriyanov-HORIS/lets-plot-docs | 30fd31cb03dc649a03518b0c9348639ebfe09d53 | [
"MIT"
] | null | null | null | docs/_downloads/e0051c6e37b730111a06abd85529e288/plot__2d_distributions.py | IKupriyanov-HORIS/lets-plot-docs | 30fd31cb03dc649a03518b0c9348639ebfe09d53 | [
"MIT"
] | null | null | null | docs/_downloads/e0051c6e37b730111a06abd85529e288/plot__2d_distributions.py | IKupriyanov-HORIS/lets-plot-docs | 30fd31cb03dc649a03518b0c9348639ebfe09d53 | [
"MIT"
] | null | null | null | """
2D Distributions
================
Some plots visualize a transformation of the original data set. Use a
stat parameter to choose a common transformation to visualize.
Each stat creates additional variables to map aesthetics to. These
variables use a common ..name.. syntax.
Look at the examples... | 29.121951 | 99 | 0.662479 | df = pd.read_csv('https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv')
w, h = 400, 300
p = ggplot(df, aes('cty', 'hwy')) + ggsize(w, h)
p11 = p + geom_bin2d() + ggtitle('geom="bin2d" + default stat')
p12 = p + geom_point(aes(color='..count..'), stat='bin2d', size=3, shape=15) + \
... | true | true |
f7046953dd226ba1a98810d21ebff8d1f0b9194a | 567 | py | Python | rxbp/indexed/impl/indexedsharedflowableimpl.py | MichaelSchneeberger/rx_backpressure | 16173827498bf1bbee3344933cb9efbfd19699f5 | [
"Apache-2.0"
] | 24 | 2018-11-22T21:04:49.000Z | 2021-11-08T11:18:09.000Z | rxbp/indexed/impl/indexedsharedflowableimpl.py | MichaelSchneeberger/rx_backpressure | 16173827498bf1bbee3344933cb9efbfd19699f5 | [
"Apache-2.0"
] | 1 | 2019-02-06T15:58:46.000Z | 2019-02-12T20:31:50.000Z | rxbp/indexed/impl/indexedsharedflowableimpl.py | MichaelSchneeberger/rx_backpressure | 16173827498bf1bbee3344933cb9efbfd19699f5 | [
"Apache-2.0"
] | 1 | 2021-01-26T12:41:37.000Z | 2021-01-26T12:41:37.000Z | from dataclasses import replace
from dataclass_abc import dataclass_abc
from rxbp.indexed.indexedflowable import IndexedFlowable
from rxbp.indexed.indexedsharedflowable import IndexedSharedFlowable
from rxbp.indexed.mixins.indexedflowablemixin import IndexedFlowableMixin
from rxbp.typing import ValueType
@dataclass... | 27 | 73 | 0.767196 | from dataclasses import replace
from dataclass_abc import dataclass_abc
from rxbp.indexed.indexedflowable import IndexedFlowable
from rxbp.indexed.indexedsharedflowable import IndexedSharedFlowable
from rxbp.indexed.mixins.indexedflowablemixin import IndexedFlowableMixin
from rxbp.typing import ValueType
@dataclass... | true | true |
f70469ec382f6f990ad177997059ee18b7c599d0 | 5,084 | py | Python | AlphaFold-local.py | Hanhui-Ma-Lab/ColabFold-in-local | 29a9d2f318cf781855186788127f484e4c7ee014 | [
"MIT"
] | null | null | null | AlphaFold-local.py | Hanhui-Ma-Lab/ColabFold-in-local | 29a9d2f318cf781855186788127f484e4c7ee014 | [
"MIT"
] | null | null | null | AlphaFold-local.py | Hanhui-Ma-Lab/ColabFold-in-local | 29a9d2f318cf781855186788127f484e4c7ee014 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#@title Input protein sequence(s), then hit `Runtime` -> `Run all`
#from google.colab import files
import os.path
import re
import hashlib
import random
def add_hash(x,y):
return x+"_"+hashlib.sha1(y.encode()).hexdigest()[:5]
with open("protein") as f:
query_... | 33.228758 | 198 | 0.700826 |
import os.path
import re
import hashlib
import random
def add_hash(x,y):
return x+"_"+hashlib.sha1(y.encode()).hexdigest()[:5]
with open("protein") as f:
query_sequence = f.read()
.join(query_sequence.split())
jobname = 'test'
basejobname = "".join(jobname.split())
basejobname = re.sub(r'\W+', '',... | true | true |
f7046a03c0614c97a9a030f915cc1c8be81beed6 | 112,252 | py | Python | src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py | taliesins/azure-cli | a2451fe7148dfdd005f0f2ec797915eb479f6f6a | [
"MIT"
] | null | null | null | src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py | taliesins/azure-cli | a2451fe7148dfdd005f0f2ec797915eb479f6f6a | [
"MIT"
] | null | null | null | src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py | taliesins/azure-cli | a2451fe7148dfdd005f0f2ec797915eb479f6f6a | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 50.907937 | 316 | 0.566974 |
import time
from azure_devtools.scenario_tests import AllowLargeResponse
from azure.cli.core.util import CLIError
from azure.cli.testsdk.base import execute
from azure.cli.testsdk.exceptions import CliTestError
from azure.cli.testsdk import (
JMESPathCheck,
JMESPathCheckExists,
JMESPathCheckGreaterTh... | true | true |
f7046ad2b8cb669f0628dd88fdf37467b4f25888 | 71 | py | Python | app/grandchallenge/evaluation/__init__.py | Tommos0/grand-challenge.org | 187cd857f6a7c9651b7bda8c42c54801f071dd7c | [
"Apache-2.0"
] | 1 | 2021-02-09T10:30:44.000Z | 2021-02-09T10:30:44.000Z | app/grandchallenge/evaluation/__init__.py | Tommos0/grand-challenge.org | 187cd857f6a7c9651b7bda8c42c54801f071dd7c | [
"Apache-2.0"
] | null | null | null | app/grandchallenge/evaluation/__init__.py | Tommos0/grand-challenge.org | 187cd857f6a7c9651b7bda8c42c54801f071dd7c | [
"Apache-2.0"
] | null | null | null | default_app_config = "grandchallenge.evaluation.apps.EvaluationConfig"
| 35.5 | 70 | 0.873239 | default_app_config = "grandchallenge.evaluation.apps.EvaluationConfig"
| true | true |
f7046bf62b21b53ac62565c24e9af84db51764a3 | 96 | py | Python | src/_stories_pytest/exceptions.py | proofit404/stories-pytest | e20a50afa42740e2bf0a19219853fcc3c33f0c15 | [
"BSD-2-Clause"
] | null | null | null | src/_stories_pytest/exceptions.py | proofit404/stories-pytest | e20a50afa42740e2bf0a19219853fcc3c33f0c15 | [
"BSD-2-Clause"
] | 10 | 2020-12-04T17:37:51.000Z | 2021-03-24T23:45:36.000Z | src/_stories_pytest/exceptions.py | proofit404/stories-pytest | e20a50afa42740e2bf0a19219853fcc3c33f0c15 | [
"BSD-2-Clause"
] | null | null | null | class StoryPytestError(Exception):
"""Base error of all stories-pytest errors."""
pass
| 19.2 | 50 | 0.697917 | class StoryPytestError(Exception):
pass
| true | true |
f7046dbb7f887b37bfad4faac3dc69cb9c0b4057 | 6,387 | py | Python | mezzanine/twitter/models.py | ShAlireza/mezzanine | 365b3e3251f341f7337f79838796112f84ab94ad | [
"BSD-2-Clause"
] | 6 | 2019-11-22T10:27:57.000Z | 2020-07-21T22:55:20.000Z | mezzanine/twitter/models.py | ShAlireza/mezzanine | 365b3e3251f341f7337f79838796112f84ab94ad | [
"BSD-2-Clause"
] | 7 | 2020-02-11T09:08:59.000Z | 2020-07-23T12:55:44.000Z | mezzanine/twitter/models.py | cjh79/mezzanine | 37712f1a1023ac0ee7e2114ac4262cedfd7f4556 | [
"BSD-2-Clause"
] | 6 | 2019-12-13T12:58:21.000Z | 2021-01-25T03:07:50.000Z | from datetime import datetime
import re
from urllib.parse import quote
from django.db import models
from django.utils.html import urlize
from django.utils.timezone import make_aware, utc
from django.utils.translation import ugettext_lazy as _
from requests_oauthlib import OAuth1
import requests
from mezzanine.conf i... | 38.017857 | 87 | 0.60357 | from datetime import datetime
import re
from urllib.parse import quote
from django.db import models
from django.utils.html import urlize
from django.utils.timezone import make_aware, utc
from django.utils.translation import ugettext_lazy as _
from requests_oauthlib import OAuth1
import requests
from mezzanine.conf i... | true | true |
f7046e1e1a9b15939c75dcbbfdbd3f1d4241b414 | 1,453 | py | Python | carfinder/urls.py | kbradle/CarFinder | d4855fd996219da593ec0612f53e6cf0c75519c5 | [
"MIT"
] | null | null | null | carfinder/urls.py | kbradle/CarFinder | d4855fd996219da593ec0612f53e6cf0c75519c5 | [
"MIT"
] | 7 | 2021-03-30T13:57:44.000Z | 2021-09-22T19:22:13.000Z | carfinder/urls.py | GaboxFH/cis4930-carfinder | 28f0933ffdfede6a4008dba37deaf78ded5d4194 | [
"MIT"
] | null | null | null | """carfinder URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... | 41.514286 | 77 | 0.741913 | from django.contrib import admin
from django.urls import path
from finder import views
from finder import forms
from django.conf.urls.static import static
from django.conf import settings
from django.conf.urls import include, url, handler404
from django.views.generic.base import TemplateView
index = views.Index()
ur... | true | true |
f7046e6627a6ca83d314b818f0fbf04dddf2131d | 3,669 | py | Python | jaseci_serv/jaseci_serv/jac_api/views.py | ChrisIsKing/jaseci | 0495cb5aed77d563213943a2090de4255241b78c | [
"MIT"
] | null | null | null | jaseci_serv/jaseci_serv/jac_api/views.py | ChrisIsKing/jaseci | 0495cb5aed77d563213943a2090de4255241b78c | [
"MIT"
] | null | null | null | jaseci_serv/jaseci_serv/jac_api/views.py | ChrisIsKing/jaseci | 0495cb5aed77d563213943a2090de4255241b78c | [
"MIT"
] | null | null | null | from rest_framework.views import APIView
from knox.auth import TokenAuthentication
from rest_framework.permissions import IsAdminUser, IsAuthenticated, AllowAny
from rest_framework.response import Response
from jaseci.utils.utils import logger
from jaseci.api.public_api import public_api
from jaseci.element.element imp... | 33.054054 | 77 | 0.652766 | from rest_framework.views import APIView
from knox.auth import TokenAuthentication
from rest_framework.permissions import IsAdminUser, IsAuthenticated, AllowAny
from rest_framework.response import Response
from jaseci.utils.utils import logger
from jaseci.api.public_api import public_api
from jaseci.element.element imp... | true | true |
f7046f7f477c957cbd276dfb161bc2b508dcad64 | 714 | py | Python | Author/migrations/0002_initial.py | CMPUT404-Fa21-Organization/CMPUT404-Project-Social-Distribution | 63c0ba2a03f0b462e3673ce7a4bf6bae7999440c | [
"Apache-2.0"
] | 3 | 2021-12-11T13:43:56.000Z | 2022-03-31T02:36:05.000Z | Author/migrations/0002_initial.py | CMPUT404-Fa21-Organization/CMPUT404-Project-Social-Distribution | 63c0ba2a03f0b462e3673ce7a4bf6bae7999440c | [
"Apache-2.0"
] | 9 | 2021-10-01T22:46:57.000Z | 2021-12-16T18:01:31.000Z | Author/migrations/0002_initial.py | CMPUT404-Fa21-Organization/CMPUT404-Project-Social-Distribution | 63c0ba2a03f0b462e3673ce7a4bf6bae7999440c | [
"Apache-2.0"
] | 2 | 2021-12-16T16:37:10.000Z | 2021-12-16T20:30:12.000Z | # Generated by Django 3.2.7 on 2021-12-02 21:01
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('Author', '0001_initial'),
('Posts', '0001_initial'),
]
operations = [
migration... | 25.5 | 118 | 0.603641 |
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('Author', '0001_initial'),
('Posts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='inbox',
... | true | true |
f7046f8691fd007d37014cd2211e82ad6141f5c5 | 1,700 | py | Python | src/Products/PluginIndexes/util.py | icemac/Products.ZCatalog | 697719cc0f1a016ab7b874237271d3e11693e78b | [
"ZPL-2.1"
] | null | null | null | src/Products/PluginIndexes/util.py | icemac/Products.ZCatalog | 697719cc0f1a016ab7b874237271d3e11693e78b | [
"ZPL-2.1"
] | 1 | 2021-02-10T16:05:38.000Z | 2021-02-10T16:05:38.000Z | src/Products/PluginIndexes/util.py | icemac/Products.ZCatalog | 697719cc0f1a016ab7b874237271d3e11693e78b | [
"ZPL-2.1"
] | 1 | 2021-02-10T15:34:58.000Z | 2021-02-10T15:34:58.000Z | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | 28.813559 | 78 | 0.606471 | true | true | |
f7046f9e665ec3601cd231ce9dc0a84025a8f89a | 7,988 | py | Python | generateFullDataset.py | Elucidation/ChessboardDetect | a5d2a2c2ab2434e4e041b4f384f3cd7d6884d2c4 | [
"MIT"
] | 43 | 2016-10-28T02:13:26.000Z | 2022-02-16T14:20:32.000Z | generateFullDataset.py | AnkaChan/ChessboardDetect | a5d2a2c2ab2434e4e041b4f384f3cd7d6884d2c4 | [
"MIT"
] | 3 | 2016-11-15T19:04:46.000Z | 2020-08-26T20:41:29.000Z | generateFullDataset.py | AnkaChan/ChessboardDetect | a5d2a2c2ab2434e4e041b4f384f3cd7d6884d2c4 | [
"MIT"
] | 12 | 2018-08-22T22:33:21.000Z | 2021-08-20T08:40:42.000Z | # Given a list of pts text files, build a complete dataset from it.
import glob
import os
import PIL.Image
import cv2
import numpy as np
from time import time
from argparse import ArgumentParser
from scipy.spatial import cKDTree
import tensorflow as tf
import SaddlePoints
import errno
def mkdir_p(path):
try:
os.... | 36.474886 | 107 | 0.654482 |
import glob
import os
import PIL.Image
import cv2
import numpy as np
from time import time
from argparse import ArgumentParser
from scipy.spatial import cKDTree
import tensorflow as tf
import SaddlePoints
import errno
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if os.path.isdir(path... | true | true |
f7046fced270fd94b0b99622ee7c5cf77efa18d6 | 984 | py | Python | q1.py | lilimonroy/CrashCourseOnPython-Functions | 9a1837faabda10036c5b5ba0e228c3fff695f92b | [
"MIT"
] | null | null | null | q1.py | lilimonroy/CrashCourseOnPython-Functions | 9a1837faabda10036c5b5ba0e228c3fff695f92b | [
"MIT"
] | null | null | null | q1.py | lilimonroy/CrashCourseOnPython-Functions | 9a1837faabda10036c5b5ba0e228c3fff695f92b | [
"MIT"
] | null | null | null | # Question 1
# This function converts miles to kilometers (km).
# Complete the function to return the result of the conversion
# Call the function to convert the trip distance from miles to kilometers
# Fill in the blank to print the result of the conversion
# Calculate the round-trip in kilometers ... | 36.444444 | 109 | 0.75 |
def convert_distance(miles):
km = miles * 1.6
return km
my_trip_miles = 55
my_trip_km = convert_distance(my_trip_miles)
print("The distance in kilometers is " + str(my_trip_km))
print("The round-trip in kilometers is " + str(my_trip_km * 2))
| true | true |
f7047041ce1f0b682dbe2f63380a8cd059b3a562 | 4,447 | py | Python | voltDivMultEnumAlternate.py | li-el/CS190IFinal | 85f7fca739f326009e86f699c5a88ca72ac8d346 | [
"Apache-2.0"
] | null | null | null | voltDivMultEnumAlternate.py | li-el/CS190IFinal | 85f7fca739f326009e86f699c5a88ca72ac8d346 | [
"Apache-2.0"
] | null | null | null | voltDivMultEnumAlternate.py | li-el/CS190IFinal | 85f7fca739f326009e86f699c5a88ca72ac8d346 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import tyrell.spec as Stuff
from tyrell.interpreter import PostOrderInterpreter
from tyrell.enumerator import SmtEnumerator, RelaxedRandomEnumerator
from tyrell.decider import Example, ExampleConstraintDecider, SimpleSpiceDecider, ExampleConstraintPruningDecider
from tyrell.synthesizer import Syn... | 28.876623 | 113 | 0.598381 |
import tyrell.spec as Stuff
from tyrell.interpreter import PostOrderInterpreter
from tyrell.enumerator import SmtEnumerator, RelaxedRandomEnumerator
from tyrell.decider import Example, ExampleConstraintDecider, SimpleSpiceDecider, ExampleConstraintPruningDecider
from tyrell.synthesizer import Synthesizer
from tyrell.... | true | true |
f70470a021e7886a90ec6d4acdea4913f2888bf5 | 903 | py | Python | src/managementgroups/azext_managementgroups/_client_factory.py | mayank88mahajan/azure-cli-extensions | 8bd389a1877bffd14052bec5519ce75dc6fc34cf | [
"MIT"
] | 1 | 2019-05-10T19:58:09.000Z | 2019-05-10T19:58:09.000Z | src/managementgroups/azext_managementgroups/_client_factory.py | mayank88mahajan/azure-cli-extensions | 8bd389a1877bffd14052bec5519ce75dc6fc34cf | [
"MIT"
] | null | null | null | src/managementgroups/azext_managementgroups/_client_factory.py | mayank88mahajan/azure-cli-extensions | 8bd389a1877bffd14052bec5519ce75dc6fc34cf | [
"MIT"
] | 1 | 2018-03-20T23:36:57.000Z | 2018-03-20T23:36:57.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 41.045455 | 94 | 0.636766 |
def cf_managementgroups(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_managementgroups.managementgroups import ManagementGroupsAPI
return get_mgmt_service_client(
cli_ctx,
ManagementGroupsAPI,
subscription_bound=False)
de... | true | true |
f704723d6929ca884f25e6f71988aa0e3ed05db5 | 7,607 | py | Python | funcsim/distfit.py | h-bryant/funcsim | 6f0ec2365e3ed6d9478e2f92e755cebafaf6528d | [
"BSD-3-Clause"
] | 1 | 2021-12-08T03:40:26.000Z | 2021-12-08T03:40:26.000Z | funcsim/distfit.py | h-bryant/funcsim | 6f0ec2365e3ed6d9478e2f92e755cebafaf6528d | [
"BSD-3-Clause"
] | null | null | null | funcsim/distfit.py | h-bryant/funcsim | 6f0ec2365e3ed6d9478e2f92e755cebafaf6528d | [
"BSD-3-Clause"
] | null | null | null |
import scipy.stats as stats
import numpy as np
import warnings
from ecdfgof import adtest, kstest
warnings.filterwarnings("ignore")
_long = [
("alpha", stats.alpha),
("anglit", stats.anglit),
("arcsine", stats.arcsine),
("argus", ... | 41.342391 | 80 | 0.449717 |
import scipy.stats as stats
import numpy as np
import warnings
from ecdfgof import adtest, kstest
warnings.filterwarnings("ignore")
_long = [
("alpha", stats.alpha),
("anglit", stats.anglit),
("arcsine", stats.arcsine),
("argus", ... | true | true |
f70473ea6441fff256a9b280f85e65dbc8390f66 | 1,683 | py | Python | projects/balancer/tests/test_erc_20_recover.py | Lido-Finance/rewards-managers | 9672cc7fbb7162ae5d84ffa395a4611f19d76eee | [
"MIT"
] | 2 | 2021-09-15T04:39:25.000Z | 2021-10-30T04:38:54.000Z | projects/balancer/tests/test_erc_20_recover.py | lidofinance/rewards-manager | 8f564c96bbca9ef9a06b5624c723429fd3558f58 | [
"MIT"
] | null | null | null | projects/balancer/tests/test_erc_20_recover.py | lidofinance/rewards-manager | 8f564c96bbca9ef9a06b5624c723429fd3558f58 | [
"MIT"
] | 1 | 2022-03-31T14:26:28.000Z | 2022-03-31T14:26:28.000Z | import pytest
from brownie import interface, RewardsManager, Contract
from utils.voting import create_vote
from utils.config import (lido_dao_voting_address,
lido_dao_agent_address,
balancer_deployed_manager,
lido_dao_token_manager_address,... | 44.289474 | 121 | 0.716578 | import pytest
from brownie import interface, RewardsManager, Contract
from utils.voting import create_vote
from utils.config import (lido_dao_voting_address,
lido_dao_agent_address,
balancer_deployed_manager,
lido_dao_token_manager_address,... | true | true |
f7047481a9d2819da9f6c9b3f58dbab818ee24c6 | 550 | py | Python | line_follow/motor.py | ryentran/roadster | 33307cc8f6707d95c7a0b3804975e4628d27e91f | [
"MIT"
] | null | null | null | line_follow/motor.py | ryentran/roadster | 33307cc8f6707d95c7a0b3804975e4628d27e91f | [
"MIT"
] | null | null | null | line_follow/motor.py | ryentran/roadster | 33307cc8f6707d95c7a0b3804975e4628d27e91f | [
"MIT"
] | 1 | 2020-03-07T21:52:32.000Z | 2020-03-07T21:52:32.000Z | import RPi.GPIO as GPIO
import time
HIN = 8
LIN = 10
freq = 500
class Motor:
def __init__(self, HIN=HIN, LIN=LIN, freq=freq):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(HIN, GPIO.OUT)
GPIO.setup(LIN, GPIO.OUT)
self.high = GPIO.PWM(HIN, freq)
self.low = GPIO.PWM(LIN, freq... | 21.153846 | 52 | 0.538182 | import RPi.GPIO as GPIO
import time
HIN = 8
LIN = 10
freq = 500
class Motor:
def __init__(self, HIN=HIN, LIN=LIN, freq=freq):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(HIN, GPIO.OUT)
GPIO.setup(LIN, GPIO.OUT)
self.high = GPIO.PWM(HIN, freq)
self.low = GPIO.PWM(LIN, freq... | true | true |
f70474925eb078c598d03d4255e4e76e7b6c9361 | 420 | py | Python | examples/function_examples/bpod_info.py | ckarageorgkaneen/pybpod-api | ebccef800ae1abf3b6a643ff33166fab2096c780 | [
"MIT"
] | 1 | 2021-01-18T08:18:22.000Z | 2021-01-18T08:18:22.000Z | examples/function_examples/bpod_info.py | ckarageorgkaneen/pybpod-api | ebccef800ae1abf3b6a643ff33166fab2096c780 | [
"MIT"
] | 1 | 2020-09-18T20:46:11.000Z | 2020-12-29T14:55:20.000Z | examples/function_examples/bpod_info.py | ckarageorgkaneen/pybpod-api | ebccef800ae1abf3b6a643ff33166fab2096c780 | [
"MIT"
] | 3 | 2020-09-12T15:32:11.000Z | 2022-03-11T23:08:03.000Z | # !/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Get hardware info from Bpod
"""
from pybpodapi.protocol import Bpod
from confapp import conf
my_bpod = Bpod()
my_bpod.close()
print("Target Bpod firmware version: ", conf.TARGET_BPOD_FIRMWARE_VERSION)
print("Firmware version (read from device): ", my_bpod.hardware.... | 21 | 81 | 0.742857 |
from pybpodapi.protocol import Bpod
from confapp import conf
my_bpod = Bpod()
my_bpod.close()
print("Target Bpod firmware version: ", conf.TARGET_BPOD_FIRMWARE_VERSION)
print("Firmware version (read from device): ", my_bpod.hardware.firmware_version)
print("Machine type version (read from device): ", my_bpod.ha... | true | true |
f704749725612792a6604ef0c554fbed25fdcc14 | 869 | py | Python | storages/dynamodb.py | cofablab/tokenscan | a5e749c94b644b02ecdc6c11e301408500e3a155 | [
"MIT"
] | 3 | 2018-08-13T09:36:57.000Z | 2022-03-29T05:10:15.000Z | storages/dynamodb.py | cofablab/tokenscan | a5e749c94b644b02ecdc6c11e301408500e3a155 | [
"MIT"
] | null | null | null | storages/dynamodb.py | cofablab/tokenscan | a5e749c94b644b02ecdc6c11e301408500e3a155 | [
"MIT"
] | 4 | 2018-09-16T08:02:49.000Z | 2020-10-14T11:37:24.000Z | import boto3
class DynamoDB(object):
def __init__(self, table_name):
self.resource = self._resource()
self.client = self._client()
self.table = self.resource.Table(table_name)
self.table_name = table_name
def _resource(self):
return boto3.resource('dynamodb')
def ... | 28.966667 | 60 | 0.631761 | import boto3
class DynamoDB(object):
def __init__(self, table_name):
self.resource = self._resource()
self.client = self._client()
self.table = self.resource.Table(table_name)
self.table_name = table_name
def _resource(self):
return boto3.resource('dynamodb')
def ... | true | true |
f704753b2aeca212b08faa33dbb2af98cfeaaeb2 | 74,031 | py | Python | DataDictionary.py | masthan549/RCT_TAXIBOT_ASSYSTEM | d896cdb2422828601170e42a91b88bbc52a80fd6 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | DataDictionary.py | masthan549/RCT_TAXIBOT_ASSYSTEM | d896cdb2422828601170e42a91b88bbc52a80fd6 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | DataDictionary.py | masthan549/RCT_TAXIBOT_ASSYSTEM | d896cdb2422828601170e42a91b88bbc52a80fd6 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null |
CCSettingsList = {'Simulink.SolverCC' : # Solver
{
'StartTime' : '0.0',
'StopTime' : 'inf',
'SolverMode' : 'SingleTasking',
'Solver' : 'FixedStepDiscrete'... | 71.666021 | 342 | 0.355783 |
CCSettingsList = {'Simulink.SolverCC' :
{
'StartTime' : '0.0',
'StopTime' : 'inf',
'SolverMode' : 'SingleTasking',
'Solver' : 'FixedStepDiscrete',
... | true | true |
f70475a66adf7de764353f9030c7c39a6130ac52 | 4,512 | py | Python | main.py | Sofa4/PyTeleBot | 00edbfdb2f74b58ce4f1c427a48c3c94cfba8c5f | [
"MIT"
] | null | null | null | main.py | Sofa4/PyTeleBot | 00edbfdb2f74b58ce4f1c427a48c3c94cfba8c5f | [
"MIT"
] | null | null | null | main.py | Sofa4/PyTeleBot | 00edbfdb2f74b58ce4f1c427a48c3c94cfba8c5f | [
"MIT"
] | null | null | null | # Телеграм-бот v.002 - бот создаёт меню, присылает собачку, и анекдот
import telebot # pyTelegramBotAPI 4.3.1
from telebot import types
import requests
import bs4
bot = telebot.TeleBot('5105972662:AAG24fr382U1_hosO4Zrb-tv_BTakAV1MPk') # Создаем экземпляр бота
# --------------------------------------------... | 50.696629 | 121 | 0.513076 |
import telebot
from telebot import types
import requests
import bs4
bot = telebot.TeleBot('5105972662:AAG24fr382U1_hosO4Zrb-tv_BTakAV1MPk')
@bot.message_handler(commands=["start"])
def start(message, res=False):
chat_id = message.chat.id
markup = types.ReplyKeyboardMarkup(resize_keyboard=Tr... | true | true |
f70475e8e3439802796c121305bf88eaa01b7b5e | 45,252 | py | Python | build/lib/SWaN_accel/classify.py | binodthapachhetry/SWaN | df54f72dfbd10bb67d3bed2cd20f3401eb779d50 | [
"MIT"
] | null | null | null | build/lib/SWaN_accel/classify.py | binodthapachhetry/SWaN | df54f72dfbd10bb67d3bed2cd20f3401eb779d50 | [
"MIT"
] | null | null | null | build/lib/SWaN_accel/classify.py | binodthapachhetry/SWaN | df54f72dfbd10bb67d3bed2cd20f3401eb779d50 | [
"MIT"
] | null | null | null | import os, gzip, pickle, sys, datetime, struct
from glob import glob
import pandas as pd
import subprocess
import shutil
import numpy as np
from datetime import timedelta
from io import StringIO
from SWaN_accel import config
from SWaN_accel import utils
from SWaN_accel import feature_set
pd.options.mode.chained_assign... | 45.894523 | 154 | 0.575356 | import os, gzip, pickle, sys, datetime, struct
from glob import glob
import pandas as pd
import subprocess
import shutil
import numpy as np
from datetime import timedelta
from io import StringIO
from SWaN_accel import config
from SWaN_accel import utils
from SWaN_accel import feature_set
pd.options.mode.chained_assign... | true | true |
f70476060d68ffc13432e8929b4d6ac973cd17fa | 12,688 | py | Python | store/adminshop/models/tienda.py | vallemrv/my_store_test | 2da624fd02c5f1784464f15b751b488f3dd2bae6 | [
"Apache-2.0"
] | null | null | null | store/adminshop/models/tienda.py | vallemrv/my_store_test | 2da624fd02c5f1784464f15b751b488f3dd2bae6 | [
"Apache-2.0"
] | null | null | null | store/adminshop/models/tienda.py | vallemrv/my_store_test | 2da624fd02c5f1784464f15b751b488f3dd2bae6 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# @Author: Manuel Rodriguez <valle>
# @Date: 28-Aug-2017
# @Email: valle.mrv@gmail.com
# @Filename: models.py
# @Last modified by: valle
# @Last modified time: 15-Feb-2018
# @License: Apache license vesion 2.0
from __future__ import unicode_literals
from django.db.models import Q
from dj... | 34.761644 | 106 | 0.595287 |
from __future__ import unicode_literals
from django.db.models import Q
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from adminshop.models import (Clientes, Direcciones, Proveedores,
Productos, Presupuesto)
CHOICES_TIPO_... | true | true |
f70476ec118903d398176eba5bc0ad6c7ca1ea45 | 4,104 | py | Python | tests/unit/dataactvalidator/test_fabs42_detached_award_financial_assistance_1.py | brianherman/data-act-broker-backend | 80eb055b9d245046192f7ad4fd0be7d0e11d2dec | [
"CC0-1.0"
] | null | null | null | tests/unit/dataactvalidator/test_fabs42_detached_award_financial_assistance_1.py | brianherman/data-act-broker-backend | 80eb055b9d245046192f7ad4fd0be7d0e11d2dec | [
"CC0-1.0"
] | 3 | 2021-08-22T11:47:45.000Z | 2022-03-29T22:06:49.000Z | tests/unit/dataactvalidator/test_fabs42_detached_award_financial_assistance_1.py | brianherman/data-act-broker-backend | 80eb055b9d245046192f7ad4fd0be7d0e11d2dec | [
"CC0-1.0"
] | 1 | 2020-07-17T23:50:56.000Z | 2020-07-17T23:50:56.000Z | from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs42_detached_award_financial_assistance_1'
def test_column_headers(database):
expected_subset = {'row_number', 'place_of_performan... | 66.193548 | 118 | 0.596491 | from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs42_detached_award_financial_assistance_1'
def test_column_headers(database):
expected_subset = {'row_number', 'place_of_performan... | true | true |
f70478107ea5e3ea6df2cd35473e2a0f32e62008 | 5,570 | py | Python | pulser/channels.py | Yash-10/Pulser | afd16e0789b2621f00f6661df6d33ff27c44ac94 | [
"Apache-2.0"
] | null | null | null | pulser/channels.py | Yash-10/Pulser | afd16e0789b2621f00f6661df6d33ff27c44ac94 | [
"Apache-2.0"
] | null | null | null | pulser/channels.py | Yash-10/Pulser | afd16e0789b2621f00f6661df6d33ff27c44ac94 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Pulser Development Team
#
# 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 i... | 36.405229 | 79 | 0.636984 |
from dataclasses import dataclass
from typing import ClassVar
import warnings
@dataclass(init=False, repr=False, frozen=True)
class Channel:
name: ClassVar[str]
basis: ClassVar[str]
addressing: str
max_abs_detuning: float
max_amp: float
retarget_time: int = None
max_targets:... | true | true |
f704795399b1cbe7ca42cc6b562a3ee519d772b4 | 4,825 | py | Python | cheddargorge/wordrelaygame/views.py | SteveWooding/cheddar-gorge | 6f99601d0534771e1fa2c41d8a6fcc8791de96e3 | [
"MIT"
] | null | null | null | cheddargorge/wordrelaygame/views.py | SteveWooding/cheddar-gorge | 6f99601d0534771e1fa2c41d8a6fcc8791de96e3 | [
"MIT"
] | null | null | null | cheddargorge/wordrelaygame/views.py | SteveWooding/cheddar-gorge | 6f99601d0534771e1fa2c41d8a6fcc8791de96e3 | [
"MIT"
] | null | null | null | """Views for the wordrelaygame app."""
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect, render
from django.views.generic import View, DetailView, ListView
from .forms import WordForm
from .models import Story
class HomeView(DetailView... | 34.71223 | 82 | 0.607668 | from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect, render
from django.views.generic import View, DetailView, ListView
from .forms import WordForm
from .models import Story
class HomeView(DetailView):
context_object_name = 'latest_st... | true | true |
f7047a75f797dfcf58fe568e7dd9f534ae570743 | 1,150 | py | Python | diags/userTime.py | Flakebi/ts3stats | d8ee1def4323c9ce1c9b88c6c22e0ff73651f46b | [
"Apache-2.0",
"MIT"
] | 9 | 2017-11-17T17:13:52.000Z | 2020-10-04T22:20:07.000Z | diags/userTime.py | Flakebi/ts3stats | d8ee1def4323c9ce1c9b88c6c22e0ff73651f46b | [
"Apache-2.0",
"MIT"
] | 1 | 2018-08-06T11:02:39.000Z | 2018-08-12T14:52:14.000Z | diags/userTime.py | ReSpeak/ts3stats | d8ee1def4323c9ce1c9b88c6c22e0ff73651f46b | [
"Apache-2.0",
"MIT"
] | 3 | 2020-10-18T16:05:29.000Z | 2021-09-12T11:45:36.000Z | from CreateTimeGraphs import *
def create_diag(dc):
"""Time spent on TeamSpeak per user"""
globalTime = timedelta()
for u in dc.users:
# Time in seconds
u.time = timedelta()
for con in u.connections:
# Increase connected time
u.time += con.duration()
us = sorted(dc.users, key = lambda u: -u.time)
for ... | 28.04878 | 93 | 0.676522 | from CreateTimeGraphs import *
def create_diag(dc):
globalTime = timedelta()
for u in dc.users:
u.time = timedelta()
for con in u.connections:
u.time += con.duration()
us = sorted(dc.users, key = lambda u: -u.time)
for u in us:
globalTime += u.time
us = us[:maxUsers]
with openTempfile("usertim... | true | true |
f7047aea295f4a46ad31eccfb2a0560c06204007 | 140 | py | Python | ctpbee/context/__init__.py | yutiansut/ctpbee | 02ceb3d4456a54b1b4f8066a2662c4b8fac1027f | [
"MIT"
] | 1 | 2019-10-31T06:45:44.000Z | 2019-10-31T06:45:44.000Z | ctpbee/context/__init__.py | dengwen168/ctpbee | 466d1f804784cf2c3e7f2ed5d28bbcf1068c9215 | [
"MIT"
] | null | null | null | ctpbee/context/__init__.py | dengwen168/ctpbee | 466d1f804784cf2c3e7f2ed5d28bbcf1068c9215 | [
"MIT"
] | 3 | 2019-11-21T03:38:14.000Z | 2022-02-14T08:09:11.000Z | from .proxy import current_app, _app_context_ctx, switch_app, get_app
__all__ = [
current_app, _app_context_ctx, switch_app, get_app
]
| 23.333333 | 69 | 0.785714 | from .proxy import current_app, _app_context_ctx, switch_app, get_app
__all__ = [
current_app, _app_context_ctx, switch_app, get_app
]
| true | true |
f7047b77b912b92a65cdfa5ae1beff0ef4bf1daf | 993 | py | Python | backends/utils.py | DaKnOb/TorPaste | fb74f645c778e9a0e5cf6f37d96a2c3d1eb631fe | [
"MIT"
] | 12 | 2016-09-28T20:48:50.000Z | 2021-06-26T21:00:38.000Z | backends/utils.py | daknob/TorPaste | fb74f645c778e9a0e5cf6f37d96a2c3d1eb631fe | [
"MIT"
] | 56 | 2016-09-25T19:30:49.000Z | 2017-10-28T22:32:57.000Z | backends/utils.py | daknob/TorPaste | fb74f645c778e9a0e5cf6f37d96a2c3d1eb631fe | [
"MIT"
] | 15 | 2016-09-25T17:57:25.000Z | 2019-12-02T14:56:27.000Z | from functools import wraps
from os import environ
from backends.exceptions import ErrorException
def wrap_exception(exception_type, error_message):
def _typed_exception_wrapper(func):
@wraps(func)
def _adapt_exception_types(*args, **kwargs):
try:
return func(*args, **... | 25.461538 | 61 | 0.640483 | from functools import wraps
from os import environ
from backends.exceptions import ErrorException
def wrap_exception(exception_type, error_message):
def _typed_exception_wrapper(func):
@wraps(func)
def _adapt_exception_types(*args, **kwargs):
try:
return func(*args, **... | true | true |
f7047bdc314b74d6a8044103b6f51f42f1a1c853 | 3,064 | py | Python | Project/TF_IDF/TF_IDF/TF_IDF_FULL.py | aksh4y/Information-Retrieval | 702ec6e6dce303a6ff8f1695e6380c10665ca888 | [
"MIT"
] | null | null | null | Project/TF_IDF/TF_IDF/TF_IDF_FULL.py | aksh4y/Information-Retrieval | 702ec6e6dce303a6ff8f1695e6380c10665ca888 | [
"MIT"
] | null | null | null | Project/TF_IDF/TF_IDF/TF_IDF_FULL.py | aksh4y/Information-Retrieval | 702ec6e6dce303a6ff8f1695e6380c10665ca888 | [
"MIT"
] | null | null | null |
# coding: utf-8
# ### All imports
# In[1]:
from tf_idf import *
from evaluation import *
# In[3]:
corpus_dict = loadCorpus("corpus")
print("corpus loaded")
# In[4]:
len(corpus_dict)
corpus_dict['CACM-0637']
# In[5]:
full_corpus_dict = loadCorpus("full_corpus")
print("full_corpus loaded")
# In[6]:
f... | 15.243781 | 122 | 0.674608 |
import *
corpus_dict = loadCorpus("corpus")
print("corpus loaded")
len(corpus_dict)
corpus_dict['CACM-0637']
full_corpus_dict = loadCorpus("full_corpus")
print("full_corpus loaded")
full_corpus_dict['CACM-0270']
unigrams_dict = generateUnigrams(corpus_dict)
print("Unigrams loaded")
len(unig... | true | true |
f7047c2b8bde539b9f3aba32ae810e49dccf2b66 | 8,667 | py | Python | qubit/utilities/gaussian.py | Xergon-sci/qubit | 3833e6fbb242572a370bfc1419b6f10d684e024b | [
"MIT"
] | null | null | null | qubit/utilities/gaussian.py | Xergon-sci/qubit | 3833e6fbb242572a370bfc1419b6f10d684e024b | [
"MIT"
] | 2 | 2020-11-20T14:05:59.000Z | 2020-11-20T18:35:42.000Z | qubit/utilities/gaussian.py | Xergon-sci/qubit | 3833e6fbb242572a370bfc1419b6f10d684e024b | [
"MIT"
] | null | null | null | import os
"""This submodule aims to provide utilities for the gaussian software package.
It will allow the user to quickly write custom interfaces to analyse the output files.
"""
class Extractor:
"""This class supports data extraction from gaussian output files.
It provides functionality to extract all the ... | 32.339552 | 114 | 0.508365 | import os
class Extractor:
def __init__(self, filepath, labels=None):
self.filepath = filepath
self.labels = labels
self.normal_executions = 0
self.check_normal_execution()
self.check_frequencies()
self.label_positions = self._get_label_positions()
... | true | true |
f7047c4cf0cecbec6882cc096843a0ec4ee2cc45 | 3,269 | py | Python | test/variational/test_unwhitened_variational_strategy.py | jrg365/gpytorch | 52bf07a3a3c55a570b22ff2bf3825adf4a6e259d | [
"MIT"
] | 188 | 2017-06-09T20:42:18.000Z | 2018-02-15T11:17:09.000Z | test/variational/test_unwhitened_variational_strategy.py | jrg365/gpytorch | 52bf07a3a3c55a570b22ff2bf3825adf4a6e259d | [
"MIT"
] | 49 | 2017-07-18T02:55:17.000Z | 2018-02-15T21:23:42.000Z | test/variational/test_unwhitened_variational_strategy.py | jrg365/gpytorch | 52bf07a3a3c55a570b22ff2bf3825adf4a6e259d | [
"MIT"
] | 24 | 2017-07-12T17:29:52.000Z | 2018-02-15T19:25:07.000Z | #!/usr/bin/env python3
import unittest
import torch
import gpytorch
from gpytorch.test.variational_test_case import VariationalTestCase
class TestUnwhitenedVariationalGP(VariationalTestCase, unittest.TestCase):
@property
def batch_shape(self):
return torch.Size([])
@property
def distributi... | 32.04902 | 111 | 0.755583 |
import unittest
import torch
import gpytorch
from gpytorch.test.variational_test_case import VariationalTestCase
class TestUnwhitenedVariationalGP(VariationalTestCase, unittest.TestCase):
@property
def batch_shape(self):
return torch.Size([])
@property
def distribution_cls(self):
... | true | true |
f7047c80bcef1eb93fe9deefa4df85a7d72cf061 | 2,893 | py | Python | xmlschema/testing/observers.py | jmuhlich/xmlschema | f5ee17fecaf46a4f88bbc46a2a2d08a9378681c1 | [
"MIT"
] | null | null | null | xmlschema/testing/observers.py | jmuhlich/xmlschema | f5ee17fecaf46a4f88bbc46a2a2d08a9378681c1 | [
"MIT"
] | null | null | null | xmlschema/testing/observers.py | jmuhlich/xmlschema | f5ee17fecaf46a4f88bbc46a2a2d08a9378681c1 | [
"MIT"
] | null | null | null | #
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... | 34.440476 | 94 | 0.637401 |
from functools import wraps
from ..names import XSD_NAMESPACE, XSD_ANY_TYPE
from ..validators import XMLSchema10, XMLSchema11, XsdGroup, XsdAttributeGroup, XsdComplexType
class SchemaObserver:
components = []
dummy_components = []
@classmethod
def observed_builder(cls, builder):
if ... | true | true |
f7047cab0fffa71371bea1dc1d55464ee8b6212b | 569 | py | Python | tests/conftest.py | bjuergens/NaturalNets | fd67f1b3c443761270adaf9877ed2a6358d830f0 | [
"MIT"
] | null | null | null | tests/conftest.py | bjuergens/NaturalNets | fd67f1b3c443761270adaf9877ed2a6358d830f0 | [
"MIT"
] | 2 | 2021-04-13T11:47:01.000Z | 2021-04-30T11:44:46.000Z | tests/conftest.py | bjuergens/NaturalNets | fd67f1b3c443761270adaf9877ed2a6358d830f0 | [
"MIT"
] | 1 | 2021-11-03T09:36:40.000Z | 2021-11-03T09:36:40.000Z | import pytest
from naturalnets.brains.i_layer_based_brain import ILayerBasedBrainCfg
from tests.pytorch_brains import IPytorchBrainCfg
@pytest.fixture
def torch_config() -> IPytorchBrainCfg:
return IPytorchBrainCfg(type="GRU_PyTorch", num_layers=3,
hidden_size=8,
... | 29.947368 | 116 | 0.690685 | import pytest
from naturalnets.brains.i_layer_based_brain import ILayerBasedBrainCfg
from tests.pytorch_brains import IPytorchBrainCfg
@pytest.fixture
def torch_config() -> IPytorchBrainCfg:
return IPytorchBrainCfg(type="GRU_PyTorch", num_layers=3,
hidden_size=8,
... | true | true |
f7047d449813bf50ec7a45d643dec9de6b8286fc | 2,870 | py | Python | batch_rl/tests/fixed_replay_runner_test.py | anonymous-code-github/offline-rl | ebe1335bab9a83e95e5c93f33fa9d248218c37e6 | [
"Apache-2.0"
] | 3 | 2019-12-27T11:56:44.000Z | 2021-08-02T03:28:24.000Z | batch_rl/tests/fixed_replay_runner_test.py | anonymous-code-github/offline-rl | ebe1335bab9a83e95e5c93f33fa9d248218c37e6 | [
"Apache-2.0"
] | null | null | null | batch_rl/tests/fixed_replay_runner_test.py | anonymous-code-github/offline-rl | ebe1335bab9a83e95e5c93f33fa9d248218c37e6 | [
"Apache-2.0"
] | 1 | 2020-10-26T20:06:13.000Z | 2020-10-26T20:06:13.000Z | # coding=utf-8
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 33.764706 | 77 | 0.705923 |
import datetime
import os
import shutil
from absl import flags
from batch_rl.fixed_replay import train
import tensorflow as tf
FLAGS = flags.FLAGS
class FixedReplayRunnerIntegrationTest(tf.test.TestCase):
def setUp(self):
super(FixedReplayRunnerIntegrationTest, self).setUp()
FLAGS.base... | true | true |
f7047d5e3cb2e30fdd03da1ab9cfcef3096c0a9c | 124 | py | Python | automatedtest_backend/datasourcemanagement/forms.py | zhousheng0325/AutomationPlatform | e7e41e4a26c63fc8151b191bccb0f4a412a3388d | [
"MIT"
] | null | null | null | automatedtest_backend/datasourcemanagement/forms.py | zhousheng0325/AutomationPlatform | e7e41e4a26c63fc8151b191bccb0f4a412a3388d | [
"MIT"
] | 10 | 2020-06-06T01:30:29.000Z | 2022-03-12T00:16:52.000Z | automatedtest_backend/datasourcemanagement/forms.py | zhousheng0325/AutomationPlatform | e7e41e4a26c63fc8151b191bccb0f4a412a3388d | [
"MIT"
] | null | null | null | from django.forms import forms, ModelForm
class FileForm(forms.Form):
file_name = forms.FileField(label=u"文件名称")
| 20.666667 | 47 | 0.725806 | from django.forms import forms, ModelForm
class FileForm(forms.Form):
file_name = forms.FileField(label=u"文件名称")
| true | true |
f7047db12c36770b75c15cf10d8ae3d6e3572d9e | 1,130 | py | Python | automatia/main.py | ShadowJonathan/automatia.py | 555d473c11372b2eec14bcd7508b4593be4fba7f | [
"MIT"
] | 1 | 2018-01-01T21:41:46.000Z | 2018-01-01T21:41:46.000Z | automatia/main.py | ShadowJonathan/automatia.py | 555d473c11372b2eec14bcd7508b4593be4fba7f | [
"MIT"
] | null | null | null | automatia/main.py | ShadowJonathan/automatia.py | 555d473c11372b2eec14bcd7508b4593be4fba7f | [
"MIT"
] | null | null | null | from __future__ import print_function
import sys
CLI = False
DEBUG = False
AUTO = False
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def setdebug(state):
global DEBUG
DEBUG = state
Debug("Python:")
for p in sys.version.split("\n"):
Debug(p)
def setauto(state)... | 14.868421 | 63 | 0.576991 | from __future__ import print_function
import sys
CLI = False
DEBUG = False
AUTO = False
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def setdebug(state):
global DEBUG
DEBUG = state
Debug("Python:")
for p in sys.version.split("\n"):
Debug(p)
def setauto(state)... | true | true |
f7047e3ed18e6d703f78bf1fed08fcc4c23c345f | 97 | py | Python | apps/timelineApp/apps.py | sepmoon/django_blog_demo | e77bb452e9161f6749ad970e5af35ec9ff7dc7a4 | [
"MIT"
] | null | null | null | apps/timelineApp/apps.py | sepmoon/django_blog_demo | e77bb452e9161f6749ad970e5af35ec9ff7dc7a4 | [
"MIT"
] | null | null | null | apps/timelineApp/apps.py | sepmoon/django_blog_demo | e77bb452e9161f6749ad970e5af35ec9ff7dc7a4 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class TimelineappConfig(AppConfig):
name = 'timelineApp'
| 16.166667 | 35 | 0.773196 | from django.apps import AppConfig
class TimelineappConfig(AppConfig):
name = 'timelineApp'
| true | true |
f7047eabbda6b249e9c546173cdd8ebd6ff6c831 | 199 | py | Python | toai/data/DataContainer.py | KipperPipper/Library_test | bdc35c2f1a6f2deadb4d0b00e3f4d5c8a597efdf | [
"MIT"
] | null | null | null | toai/data/DataContainer.py | KipperPipper/Library_test | bdc35c2f1a6f2deadb4d0b00e3f4d5c8a597efdf | [
"MIT"
] | null | null | null | toai/data/DataContainer.py | KipperPipper/Library_test | bdc35c2f1a6f2deadb4d0b00e3f4d5c8a597efdf | [
"MIT"
] | null | null | null | from typing import Any
class DataContainer:
def __init__(self, train: Any, validation: Any, test: Any):
self.train = train
self.validation = validation
self.test = test
| 22.111111 | 63 | 0.653266 | from typing import Any
class DataContainer:
def __init__(self, train: Any, validation: Any, test: Any):
self.train = train
self.validation = validation
self.test = test
| true | true |
f7047f7a029de9eb32b46e72e4d79c7e0e4d1768 | 856 | py | Python | evidence/refs/EC.py | dprada/evidence | d8400fe1a3c662be01f6f9f658fc5b92b894556d | [
"MIT"
] | null | null | null | evidence/refs/EC.py | dprada/evidence | d8400fe1a3c662be01f6f9f658fc5b92b894556d | [
"MIT"
] | null | null | null | evidence/refs/EC.py | dprada/evidence | d8400fe1a3c662be01f6f9f658fc5b92b894556d | [
"MIT"
] | 1 | 2021-11-06T16:03:46.000Z | 2021-11-06T16:03:46.000Z | class EC():
def __init__(self, id=None):
self.database = 'EC'
self.id = id
self._long_name = 'EC (Enzyme Commission) number of the Nomenclature Committee of the International Union of Biochemistry and Molecular Biology (IUBMB) Database of Interacting Proteins'
self._web = 'https://... | 21.948718 | 193 | 0.571262 | class EC():
def __init__(self, id=None):
self.database = 'EC'
self.id = id
self._long_name = 'EC (Enzyme Commission) number of the Nomenclature Committee of the International Union of Biochemistry and Molecular Biology (IUBMB) Database of Interacting Proteins'
self._web = 'https://... | true | true |
f704808d9f26f3437b8901a6051505184f96036d | 1,539 | py | Python | home/urls.py | elizabethadegbaju/dailypythontip | 4d8271e7ae84fa5b35cbafdc00f51511f4769ba8 | [
"MIT"
] | null | null | null | home/urls.py | elizabethadegbaju/dailypythontip | 4d8271e7ae84fa5b35cbafdc00f51511f4769ba8 | [
"MIT"
] | null | null | null | home/urls.py | elizabethadegbaju/dailypythontip | 4d8271e7ae84fa5b35cbafdc00f51511f4769ba8 | [
"MIT"
] | null | null | null | """dailypythontip home app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='ho... | 38.475 | 77 | 0.680962 | from django.urls import path, include
from home import views
app_name = 'home'
apis = [
path('tips/', views.api_tip_list, name='api-tip-list'),
path('tips/<int:pk>/', views.api_tip_detail, name='api-tip-detail'),
]
urlpatterns = [
path('', views.index, name='index'),
path('retweet/<int:tweet_id>/', ... | true | true |
f7048288ff2459e2e28af319740b09d01ee29e5e | 2,967 | py | Python | python/privatelink-rds/lambda_function/elb_hostname_as_target.py | aarondodd/aws-cdk-examples | 7ac382fe99656df19a4f96159c11e0aa546acaf4 | [
"Apache-2.0"
] | null | null | null | python/privatelink-rds/lambda_function/elb_hostname_as_target.py | aarondodd/aws-cdk-examples | 7ac382fe99656df19a4f96159c11e0aa546acaf4 | [
"Apache-2.0"
] | null | null | null | python/privatelink-rds/lambda_function/elb_hostname_as_target.py | aarondodd/aws-cdk-examples | 7ac382fe99656df19a4f96159c11e0aa546acaf4 | [
"Apache-2.0"
] | 1 | 2022-01-31T03:13:37.000Z | 2022-01-31T03:13:37.000Z | import json
import logging
import os
import sys
import lambda_utils as utils
"""
Configure these environment variables in your Lambda environment or
CloudFormation Inputs settings):
1. TARGET_FQDN (mandatory): The Fully Qualified DNS Name used for application
cluster
2. ELB_TG_ARN (mandatory): The ARN of the Elastic... | 35.321429 | 180 | 0.70273 | import json
import logging
import os
import sys
import lambda_utils as utils
if 'TARGET_FQDN' in os.environ:
TARGET_FQDN = os.environ['TARGET_FQDN']
else:
print("ERROR: Missing Target Hostname.")
sys.exit(1)
if 'ELB_TG_ARN' in os.environ:
ELB_TG_ARN = os.environ['ELB_TG_ARN']
else:
print("ERROR:... | true | true |
f70482921da1a6ceac1e0f0ec127bbe000ad683e | 242 | py | Python | splash/teams/__init__.py | danielballan/splash-server | 8b45075cdc556f2559b126f0b157f7107677dff1 | [
"BSD-3-Clause-LBNL"
] | null | null | null | splash/teams/__init__.py | danielballan/splash-server | 8b45075cdc556f2559b126f0b157f7107677dff1 | [
"BSD-3-Clause-LBNL"
] | null | null | null | splash/teams/__init__.py | danielballan/splash-server | 8b45075cdc556f2559b126f0b157f7107677dff1 | [
"BSD-3-Clause-LBNL"
] | null | null | null | from typing import Dict, List
from pydantic import BaseModel, Extra
class NewTeam(BaseModel):
name: str
members: Dict[str, List[str]] # uid, role
class Config:
extra = Extra.forbid
class Team(NewTeam):
uid: str
| 15.125 | 46 | 0.665289 | from typing import Dict, List
from pydantic import BaseModel, Extra
class NewTeam(BaseModel):
name: str
members: Dict[str, List[str]]
class Config:
extra = Extra.forbid
class Team(NewTeam):
uid: str
| true | true |
f7048417b44c70cf49dfe6ef12bd1218e7cfb1d0 | 2,606 | py | Python | webinterface/tests/unit_tests/test_model_Assignment.py | monoclecat/Cleaning-Schedule-generator | b12fa8a6f834a89b805bf062a0df45279a7a8796 | [
"MIT"
] | 2 | 2021-11-28T23:04:00.000Z | 2022-01-13T19:47:45.000Z | webinterface/tests/unit_tests/test_model_Assignment.py | monoclecat/Cleaning-Schedule-generator | b12fa8a6f834a89b805bf062a0df45279a7a8796 | [
"MIT"
] | 25 | 2020-03-29T14:40:46.000Z | 2021-09-22T17:37:15.000Z | webinterface/tests/unit_tests/test_model_Assignment.py | monoclecat/cleaning-schedule-management-system | b12fa8a6f834a89b805bf062a0df45279a7a8796 | [
"MIT"
] | 1 | 2020-07-04T11:42:17.000Z | 2020-07-04T11:42:17.000Z | from django.test import TestCase
from webinterface.models import *
class AssignmentTest(TestCase):
@classmethod
def setUpTestData(cls):
# Config
cls.reference_week = 2500
# Schedule
cls.schedule = Schedule.objects.create(name="schedule", cleaners_per_date=2, frequency=2, weekd... | 44.931034 | 116 | 0.719493 | from django.test import TestCase
from webinterface.models import *
class AssignmentTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.reference_week = 2500
cls.schedule = Schedule.objects.create(name="schedule", cleaners_per_date=2, frequency=2, weekday=3)
... | true | true |
f70484d154241797478949be5dae4a97f46be7bc | 681 | py | Python | tests/ci/support/capture.py | Food-X-Technologies/foodx_devops_tools | 57d1bf1304d9c9a386eaffa427f9eb36c410c350 | [
"MIT"
] | 3 | 2021-06-23T20:53:43.000Z | 2022-01-26T14:19:43.000Z | tests/ci/support/capture.py | Food-X-Technologies/foodx_devops_tools | 57d1bf1304d9c9a386eaffa427f9eb36c410c350 | [
"MIT"
] | 33 | 2021-08-09T15:44:51.000Z | 2022-03-03T18:28:02.000Z | tests/ci/support/capture.py | Food-X-Technologies/foodx_devops_tools | 57d1bf1304d9c9a386eaffa427f9eb36c410c350 | [
"MIT"
] | 1 | 2021-06-23T20:53:52.000Z | 2021-06-23T20:53:52.000Z | # Copyright (c) 2021 Food-X Technologies
#
# This file is part of foodx_devops_tools.
#
# You should have received a copy of the MIT License along with
# foodx_devops_tools. If not, see <https://opensource.org/licenses/MIT>.
import contextlib
import io
import sys
@contextlib.contextmanager
def capture_stdout_stderr(... | 26.192308 | 72 | 0.704846 |
import contextlib
import io
import sys
@contextlib.contextmanager
def capture_stdout_stderr(reset_seek: bool = True) -> None:
new_stderr = io.StringIO()
new_stdout = io.StringIO()
with contextlib.redirect_stderr(
new_stderr
) as err, contextlib.redirect_stdout(new_stdout) as out:
... | true | true |
f70484f43b430780e5466cac40adaee0fd9e1e89 | 6,217 | py | Python | download.py | kjew2/DCGAN-tensorflow | 83b2eeec3f5a9ec12f8969259f8f7502d7f088f8 | [
"MIT"
] | null | null | null | download.py | kjew2/DCGAN-tensorflow | 83b2eeec3f5a9ec12f8969259f8f7502d7f088f8 | [
"MIT"
] | null | null | null | download.py | kjew2/DCGAN-tensorflow | 83b2eeec3f5a9ec12f8969259f8f7502d7f088f8 | [
"MIT"
] | null | null | null | """
Modification of https://github.com/stanfordnlp/treelstm/blob/master/scripts/download.py
Downloads the following:
- Celeb-A dataset
- LSUN dataset
- MNIST dataset
"""
from __future__ import print_function
import os
import sys
import gzip
import json
import shutil
import zipfile
import argparse
import requests
impo... | 30.179612 | 111 | 0.675728 |
from __future__ import print_function
import os
import sys
import gzip
import json
import shutil
import zipfile
import argparse
import requests
import subprocess
from tqdm import tqdm
from six.moves import urllib
parser = argparse.ArgumentParser(description='Download dataset for DCGAN.')
parser.add_argument('datasets... | true | true |
f704863df04687682f95a46d3c76f824da117302 | 5,105 | py | Python | src/Bubot/Core/Coap/coap/optiontypes.py | businka/bubot_Core | 9c393e25467e34229e36af4badb6c9caab4fed45 | [
"MIT"
] | null | null | null | src/Bubot/Core/Coap/coap/optiontypes.py | businka/bubot_Core | 9c393e25467e34229e36af4badb6c9caab4fed45 | [
"MIT"
] | null | null | null | src/Bubot/Core/Coap/coap/optiontypes.py | businka/bubot_Core | 9c393e25467e34229e36af4badb6c9caab4fed45 | [
"MIT"
] | null | null | null | # This file is part of the Python aiocoap library project.
#
# Copyright (c) 2012-2014 Maciej Wasilak <http://sixpinetrees.blogspot.com/>,
# 2013-2014 Christian Amsüss <c.amsuess@energyharvesting.at>
#
# aiocoap is free software, this file is published under the MIT license as
# described in the accompany... | 30.568862 | 111 | 0.633497 |
import abc
import collections
import struct
class OptionType(metaclass=abc.ABCMeta):
@abc.abstractmethod
def __init__(self, number, value):
@abc.abstractmethod
def encode(self):
@abc.abstractmethod
def decode(self, rawdata):
@property
def length(self):
return len(s... | true | true |
f7048744d8474f46e17bf88b935ba327442038a6 | 7,930 | py | Python | Ch4/Jack_Car_Rental_Problem.py | ygutgutia/Reinforcement-Learning-2nd-Edition-by-Sutton-Codes | 545349260ff9895383bd9041b8cde23148d5691e | [
"MIT"
] | null | null | null | Ch4/Jack_Car_Rental_Problem.py | ygutgutia/Reinforcement-Learning-2nd-Edition-by-Sutton-Codes | 545349260ff9895383bd9041b8cde23148d5691e | [
"MIT"
] | null | null | null | Ch4/Jack_Car_Rental_Problem.py | ygutgutia/Reinforcement-Learning-2nd-Edition-by-Sutton-Codes | 545349260ff9895383bd9041b8cde23148d5691e | [
"MIT"
] | null | null | null | # https://towardsdatascience.com/elucidating-policy-iteration-in-reinforcement-learning-jacks-car-rental-problem-d41b34c8aec7
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import poisson
import sys
class Poisson:
def __init__(self, exp_num):
self.exp_num = exp_... | 39.257426 | 125 | 0.527112 |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import poisson
import sys
class Poisson:
def __init__(self, exp_num):
self.exp_num = exp_num
eps = 0.01
self.alpha = 0
state = 1
self.vals = {}
summer = 0
... | true | true |
f704874d903d18c8b7550ed375fc0e68ebb87d08 | 31,495 | py | Python | vkwave/api/methods/wall.py | peach-lasagna/vkwave | 2b752d61e94ed43ee703d3a88ecf69f6a4ffd9dd | [
"MIT"
] | 1 | 2021-01-02T00:53:32.000Z | 2021-01-02T00:53:32.000Z | vkwave/api/methods/wall.py | peach-lasagna/vkwave | 2b752d61e94ed43ee703d3a88ecf69f6a4ffd9dd | [
"MIT"
] | null | null | null | vkwave/api/methods/wall.py | peach-lasagna/vkwave | 2b752d61e94ed43ee703d3a88ecf69f6a4ffd9dd | [
"MIT"
] | null | null | null | from vkwave.types.responses import *
from ._category import Category
from ._utils import get_params
class Wall(Category):
async def check_copyright_link(
self, link: str, return_raw_response: bool = False,
) -> typing.Union[dict, BaseBoolResponse]:
"""
:param link:
:param retur... | 43.501381 | 680 | 0.635148 | from vkwave.types.responses import *
from ._category import Category
from ._utils import get_params
class Wall(Category):
async def check_copyright_link(
self, link: str, return_raw_response: bool = False,
) -> typing.Union[dict, BaseBoolResponse]:
params = get_params(locals())
raw_r... | true | true |
f704876ed9e49ed687c66cb9ce6b5baeb4b509fd | 4,281 | py | Python | train.py | sumanyumuku98/contrastive-unpaired-translation | 91738727123252e39c4e23f75f93cad737c0d718 | [
"BSD-3-Clause"
] | null | null | null | train.py | sumanyumuku98/contrastive-unpaired-translation | 91738727123252e39c4e23f75f93cad737c0d718 | [
"BSD-3-Clause"
] | null | null | null | train.py | sumanyumuku98/contrastive-unpaired-translation | 91738727123252e39c4e23f75f93cad737c0d718 | [
"BSD-3-Clause"
] | null | null | null | import time
import torch
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
opt = TrainOptions().parse() # get training options
dataset = create_dataset(opt) # create a dataset give... | 56.328947 | 186 | 0.647279 | import time
import torch
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
opt = TrainOptions().parse()
dataset = create_dataset(opt)
dataset_size = len(dataset)
mod... | true | true |
f70487a55e43f8764e423fd27ee4138a5eaf7f38 | 391 | py | Python | hymn256/wsgi.py | maximugisha/tuyimbe | cddab250b1eee38cfae045bb6568ff3ee9eb97d1 | [
"MIT"
] | null | null | null | hymn256/wsgi.py | maximugisha/tuyimbe | cddab250b1eee38cfae045bb6568ff3ee9eb97d1 | [
"MIT"
] | null | null | null | hymn256/wsgi.py | maximugisha/tuyimbe | cddab250b1eee38cfae045bb6568ff3ee9eb97d1 | [
"MIT"
] | null | null | null | """
WSGI config for hymn256 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... | 23 | 78 | 0.785166 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hymn256.settings')
application = get_wsgi_application()
| true | true |
f704883ebae70ce2217c718634167b20dfa1b69f | 80,891 | py | Python | safety_gym/envs/engine.py | frederiknolte/safety-gym | a0b3354d4d8240ed9b2bc00ef511b70ccb0f08ea | [
"MIT"
] | null | null | null | safety_gym/envs/engine.py | frederiknolte/safety-gym | a0b3354d4d8240ed9b2bc00ef511b70ccb0f08ea | [
"MIT"
] | null | null | null | safety_gym/envs/engine.py | frederiknolte/safety-gym | a0b3354d4d8240ed9b2bc00ef511b70ccb0f08ea | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import gym
import gym.spaces
import numpy as np
from PIL import Image
from copy import deepcopy
from collections import OrderedDict
import mujoco_py
from mujoco_py import MjViewer, MujocoException, const, MjRenderContextOffscreen
from safety_gym.envs.world import World, Robot
import sys
# Dis... | 48.935874 | 134 | 0.597125 |
import gym
import gym.spaces
import numpy as np
from PIL import Image
from copy import deepcopy
from collections import OrderedDict
import mujoco_py
from mujoco_py import MjViewer, MujocoException, const, MjRenderContextOffscreen
from safety_gym.envs.world import World, Robot
import sys
COLOR_CIRCLE = np.array... | true | true |
f70488df322501ed07f436eac69534372c090903 | 1,444 | py | Python | example.py | b3nj1/pymyq | 4326c1f257e7a0a75f63b714a3076ee9a68b8e50 | [
"MIT"
] | null | null | null | example.py | b3nj1/pymyq | 4326c1f257e7a0a75f63b714a3076ee9a68b8e50 | [
"MIT"
] | null | null | null | example.py | b3nj1/pymyq | 4326c1f257e7a0a75f63b714a3076ee9a68b8e50 | [
"MIT"
] | null | null | null | """Run an example script to quickly test any MyQ account."""
import asyncio
from aiohttp import ClientSession
import pymyq
from pymyq.errors import MyQError
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
try:
myq ... | 36.1 | 70 | 0.543629 | import asyncio
from aiohttp import ClientSession
import pymyq
from pymyq.errors import MyQError
async def main() -> None:
async with ClientSession() as websession:
try:
myq = await pymyq.login(
'<EMAIL>', '<PASSWORD>', '<BRAND>', websession)
devices = await myq.g... | true | true |
f7048928a7d297e2b4664be530dbd2667335e776 | 3,841 | py | Python | deprecated_library/cisco_ucs_ldap_provider_group.py | dsoper2/ucsm-ansible-1 | 9eef898d016e8e2c5f07990385ec1b8885edc533 | [
"NTP"
] | 54 | 2017-05-30T19:22:23.000Z | 2021-12-17T07:36:55.000Z | deprecated_library/cisco_ucs_ldap_provider_group.py | dsoper2/ucsm-ansible-1 | 9eef898d016e8e2c5f07990385ec1b8885edc533 | [
"NTP"
] | 50 | 2017-05-10T07:37:09.000Z | 2021-07-26T18:23:30.000Z | deprecated_library/cisco_ucs_ldap_provider_group.py | dsoper2/ucsm-ansible-1 | 9eef898d016e8e2c5f07990385ec1b8885edc533 | [
"NTP"
] | 54 | 2017-05-08T05:31:23.000Z | 2021-11-16T09:34:32.000Z | #!/usr/bin/env python
from ansible.module_utils.basic import *
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cisco_ucs_ldap_provider_group
short_description: configures ldap provider group on... | 25.269737 | 71 | 0.640198 |
from ansible.module_utils.basic import *
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cisco_ucs_ldap_provider_group
short_description: configures ldap provider group on a cisco ucs server
v... | true | true |
f70489490e1b8c1b4079c911f6d33d11550ff384 | 377 | py | Python | cwProject/dog_account/migrations/0002_auto_20190220_1723.py | cs-fullstack-2019-spring/django-models-cw-gkg901 | 32b8b7135223077c75d6bcd151652cd41d7e0397 | [
"Apache-2.0"
] | null | null | null | cwProject/dog_account/migrations/0002_auto_20190220_1723.py | cs-fullstack-2019-spring/django-models-cw-gkg901 | 32b8b7135223077c75d6bcd151652cd41d7e0397 | [
"Apache-2.0"
] | null | null | null | cwProject/dog_account/migrations/0002_auto_20190220_1723.py | cs-fullstack-2019-spring/django-models-cw-gkg901 | 32b8b7135223077c75d6bcd151652cd41d7e0397 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.0.6 on 2019-02-20 17:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dog_account', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='account',
name='accountNumber',
... | 19.842105 | 47 | 0.591512 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dog_account', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='account',
name='accountNumber',
field=models.IntegerField(),
... | true | true |
f70489cf566dca16c2b91eb084c08e0f59fe21d2 | 356 | py | Python | tests/urls.py | francbartoli/dj-experiment | ae9ec2f651b75d02d7635e1cf4c50526eea9801f | [
"MIT"
] | null | null | null | tests/urls.py | francbartoli/dj-experiment | ae9ec2f651b75d02d7635e1cf4c50526eea9801f | [
"MIT"
] | 1 | 2019-07-20T07:41:04.000Z | 2019-07-20T11:30:49.000Z | tests/urls.py | francbartoli/dj-experiment | ae9ec2f651b75d02d7635e1cf4c50526eea9801f | [
"MIT"
] | 1 | 2019-07-08T00:47:32.000Z | 2019-07-08T00:47:32.000Z | # -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from django.contrib import admin
from dj_experiment.urls import urlpatterns as dj_experiment_urls
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(dj_experiment_u... | 27.384615 | 70 | 0.764045 |
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from django.contrib import admin
from dj_experiment.urls import urlpatterns as dj_experiment_urls
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(dj_experiment_urls, namespace='dj_... | true | true |
f7048b98109faef9310cc4e31f71785ba859e4ea | 19,483 | py | Python | recpkg/implicit.py | mianuddin/csc492_recommender_pkg | 3c89bb1f4ef2a34ed4f9bb6a99ae623eaee1954b | [
"MIT"
] | null | null | null | recpkg/implicit.py | mianuddin/csc492_recommender_pkg | 3c89bb1f4ef2a34ed4f9bb6a99ae623eaee1954b | [
"MIT"
] | null | null | null | recpkg/implicit.py | mianuddin/csc492_recommender_pkg | 3c89bb1f4ef2a34ed4f9bb6a99ae623eaee1954b | [
"MIT"
] | null | null | null | import numpy as np
from sklearn.base import BaseEstimator
from tensorflow import keras
from .recommenders import KerasRecommender
class ItemPopularity(BaseEstimator):
"""Recommender based solely on interactions per item."""
def fit(self, X=None, y=None):
"""Fit the recommender from the training datas... | 40.337474 | 79 | 0.554073 | import numpy as np
from sklearn.base import BaseEstimator
from tensorflow import keras
from .recommenders import KerasRecommender
class ItemPopularity(BaseEstimator):
def fit(self, X=None, y=None):
unique, counts = np.unique(X[y == 1, 1], return_counts=True)
self.interactions_by_item = dict(zip(u... | true | true |
f7048cc1f1367b8bbc7b5e658a4723fa588322b0 | 8,478 | py | Python | main.py | lostnighter/PKUAutoSubmit | 7f40b7c195ec68bf117022df075d9829e06ca89d | [
"Apache-2.0"
] | null | null | null | main.py | lostnighter/PKUAutoSubmit | 7f40b7c195ec68bf117022df075d9829e06ca89d | [
"Apache-2.0"
] | null | null | null | main.py | lostnighter/PKUAutoSubmit | 7f40b7c195ec68bf117022df075d9829e06ca89d | [
"Apache-2.0"
] | null | null | null | from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import Firefox, Chrome, PhantomJS
... | 32.235741 | 92 | 0.677046 | from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import Firefox, Chrome, PhantomJS
... | true | true |
f7048dc3bc27f061d6236db700af312ebf28f1f8 | 32,007 | py | Python | python/ray/tests/test_runtime_env.py | Yard1/ray | 5ed3f0ce35cb3c66447858b4fc66573a13421d9a | [
"Apache-2.0"
] | 1 | 2022-01-10T07:41:17.000Z | 2022-01-10T07:41:17.000Z | python/ray/tests/test_runtime_env.py | Yard1/ray | 5ed3f0ce35cb3c66447858b4fc66573a13421d9a | [
"Apache-2.0"
] | 47 | 2021-06-19T07:05:49.000Z | 2022-03-26T07:05:03.000Z | python/ray/tests/test_runtime_env.py | Yard1/ray | 5ed3f0ce35cb3c66447858b4fc66573a13421d9a | [
"Apache-2.0"
] | null | null | null | import os
import pytest
import sys
import random
import tempfile
import time
import requests
from pathlib import Path
import ray
from ray.exceptions import RuntimeEnvSetupError
from ray._private.test_utils import (
run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition)
from ray._private.utils ... | 35.445183 | 79 | 0.643672 | import os
import pytest
import sys
import random
import tempfile
import time
import requests
from pathlib import Path
import ray
from ray.exceptions import RuntimeEnvSetupError
from ray._private.test_utils import (
run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition)
from ray._private.utils ... | true | true |
f7048dd5bea1be44951cd1d5882977c03e5f0d87 | 2,064 | py | Python | python/social/user.py | shashankgandham/darsy | 2726abcc177d340397b4b9c6bbfaca8df1555aab | [
"MIT"
] | null | null | null | python/social/user.py | shashankgandham/darsy | 2726abcc177d340397b4b9c6bbfaca8df1555aab | [
"MIT"
] | null | null | null | python/social/user.py | shashankgandham/darsy | 2726abcc177d340397b4b9c6bbfaca8df1555aab | [
"MIT"
] | null | null | null | import MySQLdb as sql
from config import sqlconfig
class users:
def __init__():
self.connection = sql.connect(
host=sqlconfig.host, user=sqlconfig.user, passwd=sqlconfig.passwd
)
self.cursor = self.connection.cursor()
def __del__():
self.cursor.close()
sel... | 30.352941 | 77 | 0.540213 | import MySQLdb as sql
from config import sqlconfig
class users:
def __init__():
self.connection = sql.connect(
host=sqlconfig.host, user=sqlconfig.user, passwd=sqlconfig.passwd
)
self.cursor = self.connection.cursor()
def __del__():
self.cursor.close()
sel... | true | true |
f7048e2f0a4416f13df925d4d6c59590417c1ebf | 3,054 | py | Python | utils/common.py | RAY-official/CryptonoteEvo-EasyMiner | 056d0b4ea129ce666c46fcc50a14a66da249540e | [
"MIT"
] | 2 | 2018-04-16T22:34:04.000Z | 2018-06-19T06:51:54.000Z | utils/common.py | RAY-official/CryptonoteEvo-EasyMiner | 056d0b4ea129ce666c46fcc50a14a66da249540e | [
"MIT"
] | 1 | 2021-01-03T06:20:09.000Z | 2021-01-03T06:20:09.000Z | utils/common.py | RAY-official/CryptonoteEvo-EasyMiner | 056d0b4ea129ce666c46fcc50a14a66da249540e | [
"MIT"
] | 5 | 2018-04-20T03:27:57.000Z | 2018-06-19T06:52:52.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
helper classes and functions
'''
import os, sys, string, hashlib
import re, textwrap
from unicodedata import normalize
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
class DummyStream:
''' dummyStream behaves like a... | 25.663866 | 89 | 0.592993 |
import os, sys, string, hashlib
import re, textwrap
from unicodedata import normalize
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
class DummyStream:
def __init__(self): pass
def write(self,data): pass
def read(self,data): pass
def flush(self): ... | true | true |
f7048e8d6bdc977b635892b006b5eb0649f3110a | 573 | py | Python | openCV_basics.py | Avisek1999/Face-recognition-using-OpenCV | 1d24b077f1ee23aa2fa9d7cac843a11a41fee243 | [
"Unlicense"
] | 3 | 2020-12-31T04:03:58.000Z | 2021-01-04T10:19:24.000Z | openCV_basics.py | Avisek1999/Face-recognition-using-OpenCV | 1d24b077f1ee23aa2fa9d7cac843a11a41fee243 | [
"Unlicense"
] | null | null | null | openCV_basics.py | Avisek1999/Face-recognition-using-OpenCV | 1d24b077f1ee23aa2fa9d7cac843a11a41fee243 | [
"Unlicense"
] | null | null | null | import cv2
import numpy as np
#load colored image
img_1 = cv2.imread("Images\\sunflower.png", 1)
#load grayscale image
img_2 = cv2.imread("Images\\sunflower.png", 0)
#resizing images
resized_img_1 = cv2.resize(img_1, (int(img_1.shape[1]/2), int(img_1.shape[0]/2)))
#printing images' shape(dimension)
pri... | 22.038462 | 82 | 0.717277 | import cv2
import numpy as np
img_1 = cv2.imread("Images\\sunflower.png", 1)
img_2 = cv2.imread("Images\\sunflower.png", 0)
resized_img_1 = cv2.resize(img_1, (int(img_1.shape[1]/2), int(img_1.shape[0]/2)))
print(img_1.shape)
print(img_2.shape)
#displaying the loaded images
cv2.imshow("Colored Imag... | true | true |
f7048f1a9a11cee84225e69d7beb21203457c55f | 3,978 | py | Python | docs/_ext/clientservergen.py | mfkiwl/siliconcompiler | 49a16d9a07c526821afe1ce2f2d77394e439ca05 | [
"Apache-2.0"
] | 424 | 2021-12-04T15:45:12.000Z | 2022-03-31T20:27:55.000Z | docs/_ext/clientservergen.py | mfkiwl/siliconcompiler | 49a16d9a07c526821afe1ce2f2d77394e439ca05 | [
"Apache-2.0"
] | 105 | 2021-12-03T21:25:29.000Z | 2022-03-31T22:36:59.000Z | docs/_ext/clientservergen.py | mfkiwl/siliconcompiler | 49a16d9a07c526821afe1ce2f2d77394e439ca05 | [
"Apache-2.0"
] | 38 | 2021-12-04T21:26:20.000Z | 2022-03-21T02:39:29.000Z | import glob
import json
from docutils import nodes
from sphinx.util.docutils import SphinxDirective
from sphinx.util import logging
def add_prop_attr_row(prop, attr, tbody, key = None):
desc_row = nodes.row()
tbody += desc_row
desc_row += nodes.entry()
desc_key_entry = nodes.entry()
desc_row += d... | 38.621359 | 107 | 0.621418 | import glob
import json
from docutils import nodes
from sphinx.util.docutils import SphinxDirective
from sphinx.util import logging
def add_prop_attr_row(prop, attr, tbody, key = None):
desc_row = nodes.row()
tbody += desc_row
desc_row += nodes.entry()
desc_key_entry = nodes.entry()
desc_row += d... | true | true |
f7048f5661e35d4d435933172495a0e02500488f | 871 | py | Python | Tools/bloat/BloatReport.py | studentutu/StereoKit | 560d0048a2b1bfd07362156ef417963a493c03f0 | [
"MIT"
] | null | null | null | Tools/bloat/BloatReport.py | studentutu/StereoKit | 560d0048a2b1bfd07362156ef417963a493c03f0 | [
"MIT"
] | null | null | null | Tools/bloat/BloatReport.py | studentutu/StereoKit | 560d0048a2b1bfd07362156ef417963a493c03f0 | [
"MIT"
] | null | null | null | # Works on Linux .sym files generated using the nm command
# Like this:
# nm -CSr --size-sort StereoKitC.sym > size.txt
import re
data = {}
file1 = open('size.txt', 'r')
while True:
line = file1.readline()
# if line is empty end of file is reached
if not line:
break
matches = re.search("(\... | 22.921053 | 82 | 0.566016 |
import re
data = {}
file1 = open('size.txt', 'r')
while True:
line = file1.readline()
if not line:
break
matches = re.search("(\w*) (\w*) (\w*) ([^_:<(]*)(?:[_:<(]*)([^_:<(]*)", line)
size = int(matches[2], 16)
namespace = matches[4]
if ' ' in namespace:
namespace... | true | true |
f7048fa3de1ae89344e12248110f1a92f5d66f51 | 3,013 | gyp | Python | ion/base/tests/base_tests.gyp | isabella232/ion-1 | ef47f3b824050499ce5c6f774b366f6c4dbce0af | [
"Apache-2.0"
] | 1 | 2020-03-12T12:49:31.000Z | 2020-03-12T12:49:31.000Z | ion/base/tests/base_tests.gyp | isabella232/ion-1 | ef47f3b824050499ce5c6f774b366f6c4dbce0af | [
"Apache-2.0"
] | null | null | null | ion/base/tests/base_tests.gyp | isabella232/ion-1 | ef47f3b824050499ce5c6f774b366f6c4dbce0af | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 28.424528 | 74 | 0.580153 |
{
'includes': [
'../../common.gypi',
],
'targets': [
{
'target_name': 'ionbase_test',
'includes': [
'../../dev/test_target.gypi',
],
'sources' : [
'allocatable_test.cc',
'allocationmanager_test.cc',
'allocator_test.cc',
'array... | true | true |
f704901a93e192ad8759e2788d6ef18e842361c1 | 3,891 | py | Python | SA.py | ccfelius/TravelingSalesMan | ebc3b960859590623c0eb301545cd093c41d157a | [
"MIT"
] | 1 | 2020-12-10T17:36:39.000Z | 2020-12-10T17:36:39.000Z | SA.py | ccfelius/TravelingSalesMan | ebc3b960859590623c0eb301545cd093c41d157a | [
"MIT"
] | null | null | null | SA.py | ccfelius/TravelingSalesMan | ebc3b960859590623c0eb301545cd093c41d157a | [
"MIT"
] | 1 | 2021-01-05T13:08:07.000Z | 2021-01-05T13:08:07.000Z | """ TSP SIMULATED ANNEALING """
# Imports
import math
import numpy as np
# read data from file
f = open("TSP-configurations/eil51.tsp.txt", "r")
# f = open("TSP-configurations/a280.tsp.txt", "r")
# f = open("TSP-configurations/pcb442.tsp.txt", "r")
network = f.readlines()[6:-1]
# create dictionary to store coordina... | 28.40146 | 85 | 0.57029 |
import math
import numpy as np
f = open("TSP-configurations/eil51.tsp.txt", "r")
network = f.readlines()[6:-1]
nodes = dict()
for node in network:
node = list(map(int, (list(filter(None, node.rstrip().rsplit(' '))))))
nodes[node[0]] = node[1:]
def get_distance(dictionary, city1, city2):
x = dic... | true | true |
f7049196395e122f4eca3d7334b860dc0235da5b | 3,601 | py | Python | src/networkx/algorithms/centrality/dispersion.py | MarletteFunding/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | [
"Apache-2.0"
] | 184 | 2017-12-20T21:50:06.000Z | 2022-03-19T13:24:58.000Z | src/networkx/algorithms/centrality/dispersion.py | MarletteFunding/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | [
"Apache-2.0"
] | 26 | 2020-03-24T18:07:06.000Z | 2022-03-12T00:12:27.000Z | src/networkx/algorithms/centrality/dispersion.py | MarletteFunding/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | [
"Apache-2.0"
] | 136 | 2018-01-09T22:52:06.000Z | 2022-02-24T13:26:18.000Z | from itertools import combinations
__author__ = "\n".join(['Ben Edwards (bedwards@cs.unm.edu)',
'Huston Hedinger (h@graphalchemist.com)',
'Dan Schult (dschult@colgate.edu)'])
__all__ = ['dispersion']
def dispersion(G, u=None, v=None, normalized=True, alpha=1.0, b=0.0,... | 33.971698 | 80 | 0.55429 | from itertools import combinations
__author__ = "\n".join(['Ben Edwards (bedwards@cs.unm.edu)',
'Huston Hedinger (h@graphalchemist.com)',
'Dan Schult (dschult@colgate.edu)'])
__all__ = ['dispersion']
def dispersion(G, u=None, v=None, normalized=True, alpha=1.0, b=0.0,... | true | true |
f70493c9a0cc1f2c13dcbfc9dfb2210631e94583 | 2,512 | py | Python | PyMesh/third_party/json/test/thirdparty/imapdl/filterbr.py | VincentLefevre/3D-parallax | 8eab905fcc591e1bd7ddbbb01ad21427286c02e3 | [
"MIT"
] | 73 | 2021-01-05T07:25:51.000Z | 2022-03-17T20:46:01.000Z | PyMesh/third_party/json/test/thirdparty/imapdl/filterbr.py | VincentLefevre/3D-parallax | 8eab905fcc591e1bd7ddbbb01ad21427286c02e3 | [
"MIT"
] | 1 | 2021-01-05T11:45:36.000Z | 2021-01-05T20:55:28.000Z | PyMesh/third_party/json/test/thirdparty/imapdl/filterbr.py | VincentLefevre/3D-parallax | 8eab905fcc591e1bd7ddbbb01ad21427286c02e3 | [
"MIT"
] | 4 | 2021-01-05T10:27:50.000Z | 2021-01-06T12:02:57.000Z | #!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
import sys
def skip_comments(lines):
state = 0
for line in lines:
n = len(line)
l = ''
p = 0
while p < n:
if state == 0:
a = line.find('//', p)
b = line.find('/*', p)
if a > -1 and (a ... | 22.836364 | 63 | 0.446656 |
import sys
def skip_comments(lines):
state = 0
for line in lines:
n = len(line)
l = ''
p = 0
while p < n:
if state == 0:
a = line.find('//', p)
b = line.find('/*', p)
if a > -1 and (a < b or b == -1):
l += line[p:a]
p = n
... | true | true |
f70495bb0052a07d968c92ff79a3d057cb7c3203 | 1,096 | py | Python | backend/users/views.py | crowdbotics-apps/secretariado-28865 | 8f408879a0810cd1436e5131c650614cd8ffe996 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/users/views.py | crowdbotics-apps/secretariado-28865 | 8f408879a0810cd1436e5131c650614cd8ffe996 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/users/views.py | crowdbotics-apps/secretariado-28865 | 8f408879a0810cd1436e5131c650614cd8ffe996 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | from .models import User
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import (
RedirectView,
UpdateView,
DetailView,
CreateView,
ListView,
)
User = get_user_model()
class UserDeta... | 21.92 | 87 | 0.740876 | from .models import User
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import (
RedirectView,
UpdateView,
DetailView,
CreateView,
ListView,
)
User = get_user_model()
class UserDeta... | true | true |
f7049608dda90179b124282c63b735b1d9d049b8 | 26 | py | Python | homeassistant/components/moon/__init__.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 22,481 | 2020-03-02T13:09:59.000Z | 2022-03-31T23:34:28.000Z | homeassistant/components/moon/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | homeassistant/components/moon/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 11,411 | 2020-03-02T14:19:20.000Z | 2022-03-31T22:46:07.000Z | """The moon component."""
| 13 | 25 | 0.615385 | true | true | |
f70496db8e1118a8641f5a173b38fdd3b02d0c27 | 4,148 | py | Python | tests/main.py | mbhavya/fastapi | 1876ebc77949a9a254909ec61ea0c09365169ec2 | [
"MIT"
] | 1 | 2022-01-08T16:39:28.000Z | 2022-01-08T16:39:28.000Z | tests/main.py | mbhavya/fastapi | 1876ebc77949a9a254909ec61ea0c09365169ec2 | [
"MIT"
] | 1 | 2022-01-07T21:04:04.000Z | 2022-01-07T21:04:04.000Z | tests/main.py | mbhavya/fastapi | 1876ebc77949a9a254909ec61ea0c09365169ec2 | [
"MIT"
] | null | null | null | import http
from typing import Optional
from fastapi import FastAPI, Path, Query
app = FastAPI()
@app.api_route("/api_route")
def non_operation():
return {"message": "Hello World"}
def non_decorated_route():
return {"message": "Hello World"}
app.add_api_route("/non_decorated_route", non_decorated_route)... | 21.271795 | 83 | 0.695516 | import http
from typing import Optional
from fastapi import FastAPI, Path, Query
app = FastAPI()
@app.api_route("/api_route")
def non_operation():
return {"message": "Hello World"}
def non_decorated_route():
return {"message": "Hello World"}
app.add_api_route("/non_decorated_route", non_decorated_route)... | true | true |
f7049890a92c42d868eb4e25fb45d02dcc4f93fd | 4,411 | py | Python | scripts/build.py | nvrrdt/onzecurrency | 55ecc8b5bb38a19b344830d6da847b7f1f19c8b6 | [
"MIT"
] | null | null | null | scripts/build.py | nvrrdt/onzecurrency | 55ecc8b5bb38a19b344830d6da847b7f1f19c8b6 | [
"MIT"
] | null | null | null | scripts/build.py | nvrrdt/onzecurrency | 55ecc8b5bb38a19b344830d6da847b7f1f19c8b6 | [
"MIT"
] | null | null | null | import argparse
import sys
import os
import subprocess
from pathlib import Path
import threading
def main():
# Cd to scripts/build.py directory
os.chdir(os.path.dirname(__file__))
# Initialize parser
parser = argparse.ArgumentParser()
# Adding optional arguments
parser.add_argument("-r", ... | 42.009524 | 136 | 0.602584 | import argparse
import sys
import os
import subprocess
from pathlib import Path
import threading
def main():
os.chdir(os.path.dirname(__file__))
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--remove-build-dir", help = "Remove build directory", action="store_true")
... | true | true |
f70498c5a47f6ef9481f54711317f78fc1ab8f48 | 930 | py | Python | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/04. Exercise - Classes and Objects/07_spoopify/project/band.py | kzborisov/SoftUni | ccb2b8850adc79bfb2652a45124c3ff11183412e | [
"MIT"
] | 1 | 2021-02-07T07:51:12.000Z | 2021-02-07T07:51:12.000Z | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/04. Exercise - Classes and Objects/07_spoopify/project/band.py | kzborisov/softuni | 9c5b45c74fa7d9748e9b3ea65a5ae4e15c142751 | [
"MIT"
] | null | null | null | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/04. Exercise - Classes and Objects/07_spoopify/project/band.py | kzborisov/softuni | 9c5b45c74fa7d9748e9b3ea65a5ae4e15c142751 | [
"MIT"
] | null | null | null | from project.album import Album
class Band:
def __init__(self, name):
self.name = name
self.albums = []
def add_album(self, album: Album):
if album in self.albums:
return f"Band {self.name} already has {album.name} in their library."
self.albums.append(album)
... | 30 | 81 | 0.587097 | from project.album import Album
class Band:
def __init__(self, name):
self.name = name
self.albums = []
def add_album(self, album: Album):
if album in self.albums:
return f"Band {self.name} already has {album.name} in their library."
self.albums.append(album)
... | true | true |
f7049bcbc6fa44319a06c361bcb0eacc74d82e6b | 5,312 | py | Python | vagrant/vagrant/MPTCP_kernel5.5-WRR0.3_RPi4/mptcp_ctrl/mptcp_wrr_controller.py | jorgenavarroortiz/multitechnology_testbed_v0 | 970aa205d29de725f5c6501bac72cc9212eb4c8e | [
"Apache-2.0"
] | null | null | null | vagrant/vagrant/MPTCP_kernel5.5-WRR0.3_RPi4/mptcp_ctrl/mptcp_wrr_controller.py | jorgenavarroortiz/multitechnology_testbed_v0 | 970aa205d29de725f5c6501bac72cc9212eb4c8e | [
"Apache-2.0"
] | null | null | null | vagrant/vagrant/MPTCP_kernel5.5-WRR0.3_RPi4/mptcp_ctrl/mptcp_wrr_controller.py | jorgenavarroortiz/multitechnology_testbed_v0 | 970aa205d29de725f5c6501bac72cc9212eb4c8e | [
"Apache-2.0"
] | 1 | 2022-02-16T14:59:10.000Z | 2022-02-16T14:59:10.000Z | import ipaddress
import socket
import os
def execute_sysctl_command(params):
print("-> sysctl "+params)
os.system('sysctl ' + params)
def ip_string_to_unsigned_int(ip):
ip_ = 0
bytes_ = ip.split(".")
if len(bytes_) == 4:
ip_ = socket.htonl((int(bytes_[0]) << 24) + (int(bytes_[1]) << 16) +... | 32.588957 | 116 | 0.639307 | import ipaddress
import socket
import os
def execute_sysctl_command(params):
print("-> sysctl "+params)
os.system('sysctl ' + params)
def ip_string_to_unsigned_int(ip):
ip_ = 0
bytes_ = ip.split(".")
if len(bytes_) == 4:
ip_ = socket.htonl((int(bytes_[0]) << 24) + (int(bytes_[1]) << 16) +... | true | true |
f7049c852a7dbf185cd530f868f69bde4a8ef100 | 329 | py | Python | hidrocomp/files/nasa.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | 4 | 2020-05-14T20:03:49.000Z | 2020-05-22T19:56:43.000Z | hidrocomp/files/nasa.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | 19 | 2019-06-27T18:12:27.000Z | 2020-04-28T13:28:03.000Z | hidrocomp/files/nasa.py | clebsonpy/HydroComp | 9d17fa533e8a15c760030df5246ff531ddb4cb22 | [
"MIT"
] | null | null | null | """
Created on 21 de mar de 2018
@author: clebson
"""
from hidrocomp.files.fileRead import FileRead
class Nasa(FileRead):
"""
class files read: National Aeronautics and
Space Administration - NASA
"""
source = "NASA"
extension = "hdf5"
def __init__(self, params):
... | 17.315789 | 47 | 0.604863 | from hidrocomp.files.fileRead import FileRead
class Nasa(FileRead):
source = "NASA"
extension = "hdf5"
def __init__(self, params):
pass
| true | true |
f7049d22f74611a447ad986760f14af356310d64 | 4,983 | py | Python | rain_api_core/general_util.py | asfadmin/rain-api-core | 99985d4a346ab06449a42ed6b5b91f36d2bc760a | [
"Apache-2.0"
] | 1 | 2020-05-06T22:01:22.000Z | 2020-05-06T22:01:22.000Z | rain_api_core/general_util.py | asfadmin/rain-api-core | 99985d4a346ab06449a42ed6b5b91f36d2bc760a | [
"Apache-2.0"
] | 87 | 2019-09-16T20:45:59.000Z | 2022-03-31T21:18:44.000Z | rain_api_core/general_util.py | asfadmin/rain-api-core | 99985d4a346ab06449a42ed6b5b91f36d2bc760a | [
"Apache-2.0"
] | 2 | 2020-05-06T22:01:29.000Z | 2021-03-23T18:22:52.000Z | import logging
import os
import sys
import json
import time
import re
UNCENSORED_LOGGING = os.getenv("UNCENSORED_LOGGING")
LOG_CENSOR = [
{ "regex": r"(eyJ0e[A-Za-z0-9-_]{10})[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*([A-Za-z0-9-_]{10})",
"replace": "\\g<1>XXX<JWTTOKEN>XXX\\g<2>",
"des... | 36.372263 | 129 | 0.551074 | import logging
import os
import sys
import json
import time
import re
UNCENSORED_LOGGING = os.getenv("UNCENSORED_LOGGING")
LOG_CENSOR = [
{ "regex": r"(eyJ0e[A-Za-z0-9-_]{10})[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*([A-Za-z0-9-_]{10})",
"replace": "\\g<1>XXX<JWTTOKEN>XXX\\g<2>",
"des... | true | true |
f7049d363796cb6667a5daca0af53654e2731d01 | 1,237 | py | Python | localstack/services/kms/kms_starter.py | matt-mercer/localstack | b69ba25e495c6ef889d33a050b216d0cd1035041 | [
"Apache-2.0"
] | null | null | null | localstack/services/kms/kms_starter.py | matt-mercer/localstack | b69ba25e495c6ef889d33a050b216d0cd1035041 | [
"Apache-2.0"
] | null | null | null | localstack/services/kms/kms_starter.py | matt-mercer/localstack | b69ba25e495c6ef889d33a050b216d0cd1035041 | [
"Apache-2.0"
] | null | null | null | import logging
import platform
from localstack import config
from localstack.constants import TEST_AWS_ACCOUNT_ID
from localstack.services.infra import do_run, log_startup_message, start_proxy_for_service
from localstack.services.install import INSTALL_PATH_KMS_BINARY_PATTERN
from localstack.utils.common import get_ar... | 37.484848 | 91 | 0.754244 | import logging
import platform
from localstack import config
from localstack.constants import TEST_AWS_ACCOUNT_ID
from localstack.services.infra import do_run, log_startup_message, start_proxy_for_service
from localstack.services.install import INSTALL_PATH_KMS_BINARY_PATTERN
from localstack.utils.common import get_ar... | true | true |
f7049e63a0d463eea3205b339c8de1a0009f2c66 | 362 | py | Python | src/ralph/networks/migrations/0012_remove_network_dns_servers.py | DoNnMyTh/ralph | 97b91639fa68965ad3fd9d0d2652a6545a2a5b72 | [
"Apache-2.0"
] | 1,668 | 2015-01-01T12:51:20.000Z | 2022-03-29T09:05:35.000Z | src/ralph/networks/migrations/0012_remove_network_dns_servers.py | hq-git/ralph | e2448caf02d6e5abfd81da2cff92aefe0a534883 | [
"Apache-2.0"
] | 2,314 | 2015-01-02T13:26:26.000Z | 2022-03-29T04:06:03.000Z | src/ralph/networks/migrations/0012_remove_network_dns_servers.py | hq-git/ralph | e2448caf02d6e5abfd81da2cff92aefe0a534883 | [
"Apache-2.0"
] | 534 | 2015-01-05T12:40:28.000Z | 2022-03-29T21:10:12.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('networks', '0011_add_dns_servers_group'),
]
operations = [
migrations.RemoveField(
model_name='network',
... | 19.052632 | 51 | 0.61326 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('networks', '0011_add_dns_servers_group'),
]
operations = [
migrations.RemoveField(
model_name='network',
name='dns_servers'... | true | true |
f7049fbb24e7b82c25e46d99558fde78cfce0fcd | 16,602 | py | Python | Lib/unittest/test/test_program.py | juliangilbey/cpython | 3aa5242b54b0627293d95cfb4a26b2f917f667be | [
"0BSD"
] | 52,316 | 2015-01-01T15:56:25.000Z | 2022-03-31T23:19:01.000Z | Lib/unittest/test/test_program.py | juliangilbey/cpython | 3aa5242b54b0627293d95cfb4a26b2f917f667be | [
"0BSD"
] | 25,286 | 2015-03-03T23:18:02.000Z | 2022-03-31T23:17:27.000Z | Lib/unittest/test/test_program.py | yangruihan/cpython | 80e22edd4169241d16425bad0d0c4a074f5f5f99 | [
"0BSD"
] | 31,623 | 2015-01-01T13:29:37.000Z | 2022-03-31T19:55:06.000Z | import io
import os
import sys
import subprocess
from test import support
import unittest
import unittest.test
from .test_result import BufferedWriter
class Test_TestProgram(unittest.TestCase):
def test_discovery_from_dotted_path(self):
loader = unittest.TestLoader()
tests = [self]
expe... | 34.951579 | 103 | 0.585291 | import io
import os
import sys
import subprocess
from test import support
import unittest
import unittest.test
from .test_result import BufferedWriter
class Test_TestProgram(unittest.TestCase):
def test_discovery_from_dotted_path(self):
loader = unittest.TestLoader()
tests = [self]
expe... | true | true |
f704a1ff97c284787533ec880d3da162935ecff3 | 22 | py | Python | unit_test/__init__.py | whitews/ReFlowRESTClient | 69369bbea501382291b71facea7a511ab8f7848b | [
"BSD-3-Clause"
] | null | null | null | unit_test/__init__.py | whitews/ReFlowRESTClient | 69369bbea501382291b71facea7a511ab8f7848b | [
"BSD-3-Clause"
] | null | null | null | unit_test/__init__.py | whitews/ReFlowRESTClient | 69369bbea501382291b71facea7a511ab8f7848b | [
"BSD-3-Clause"
] | null | null | null | __author__ = 'swhite'
| 11 | 21 | 0.727273 | __author__ = 'swhite'
| true | true |
f704a2cf5b5e1689076d0448825bb78481f3bd45 | 730 | py | Python | src/main.py | GoogleCloudPlatform/appengine-blobstoremgmt-python | 157883b45099b0e012273f321ac250d463dca8e7 | [
"Apache-2.0"
] | 2 | 2019-01-25T08:56:41.000Z | 2021-09-19T11:22:09.000Z | src/main.py | GoogleCloudPlatform/appengine-blobstoremgmt-python | 157883b45099b0e012273f321ac250d463dca8e7 | [
"Apache-2.0"
] | null | null | null | src/main.py | GoogleCloudPlatform/appengine-blobstoremgmt-python | 157883b45099b0e012273f321ac250d463dca8e7 | [
"Apache-2.0"
] | 5 | 2018-12-29T03:00:02.000Z | 2021-09-08T04:42:56.000Z | # Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 31.73913 | 74 | 0.761644 |
import webapp2
from app import routes
APP = webapp2.WSGIApplication(routes.ROUTES)
| true | true |
f704a3a4f2ec4e373be9ec1f21a6878561d4f135 | 2,192 | py | Python | mmseg/apis/ote/apis/segmentation/model_wrappers/blur.py | yunchu/mmsegmentation | 404f3e0e8859991931b6a39a583de412348e98f0 | [
"Apache-2.0"
] | null | null | null | mmseg/apis/ote/apis/segmentation/model_wrappers/blur.py | yunchu/mmsegmentation | 404f3e0e8859991931b6a39a583de412348e98f0 | [
"Apache-2.0"
] | null | null | null | mmseg/apis/ote/apis/segmentation/model_wrappers/blur.py | yunchu/mmsegmentation | 404f3e0e8859991931b6a39a583de412348e98f0 | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 40.592593 | 127 | 0.734033 |
import cv2
import numpy as np
from typing import Any, Dict
from openvino.model_zoo.model_api.models import SegmentationModel
from openvino.model_zoo.model_api.models.types import NumericalValue
from ote_sdk.utils.segmentation_utils import create_hard_prediction_from_soft_prediction
class BlurSegmentati... | true | true |
f704a3b79279dcbc7d7c7af917820dc235520c9f | 1,506 | py | Python | metatags/templatetags/metatags.py | skylax1/django-simple-metatags | 6aa01733e60f8ad87f6bc3a8fb81c2cdfcb7a09c | [
"MIT"
] | null | null | null | metatags/templatetags/metatags.py | skylax1/django-simple-metatags | 6aa01733e60f8ad87f6bc3a8fb81c2cdfcb7a09c | [
"MIT"
] | null | null | null | metatags/templatetags/metatags.py | skylax1/django-simple-metatags | 6aa01733e60f8ad87f6bc3a8fb81c2cdfcb7a09c | [
"MIT"
] | null | null | null | from django.db import models
from django.template import Library
from ..models import MetaTag
from ..utils import truncate_language_code_from_path, check_caching_enabled
register = Library()
@register.inclusion_tag('metatags/includes/metatags.html', takes_context=True)
def include_metatags(context, model_instance=N... | 43.028571 | 114 | 0.727756 | from django.db import models
from django.template import Library
from ..models import MetaTag
from ..utils import truncate_language_code_from_path, check_caching_enabled
register = Library()
@register.inclusion_tag('metatags/includes/metatags.html', takes_context=True)
def include_metatags(context, model_instance=N... | true | true |
f704a42698e00cb319b9b229f831e142b1aebfcd | 154,799 | py | Python | nova/cmd/manage.py | muraliselva10/nova | 97626394bcce5c8cd020b136ca54a6aa919eb3a9 | [
"Apache-2.0"
] | null | null | null | nova/cmd/manage.py | muraliselva10/nova | 97626394bcce5c8cd020b136ca54a6aa919eb3a9 | [
"Apache-2.0"
] | null | null | null | nova/cmd/manage.py | muraliselva10/nova | 97626394bcce5c8cd020b136ca54a6aa919eb3a9 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");... | 45.368992 | 79 | 0.598247 |
import collections
import functools
import os
import re
import sys
import time
import traceback
import typing as ty
from urllib import parse as urlparse
from dateutil import parser as dateutil_parser
from keystoneauth1 import exceptions as ks_exc
from neutronclient.common import exceptions as neutr... | true | true |
f704a5f03f32848876ade8470cc6ada426442677 | 18,070 | py | Python | src/python/pants/option/config.py | yoav-orca/pants | 995448e9add343975844c7a43d5d64618fc4e4d9 | [
"Apache-2.0"
] | 1,806 | 2015-01-05T07:31:00.000Z | 2022-03-31T11:35:41.000Z | src/python/pants/option/config.py | yoav-orca/pants | 995448e9add343975844c7a43d5d64618fc4e4d9 | [
"Apache-2.0"
] | 9,565 | 2015-01-02T19:01:59.000Z | 2022-03-31T23:25:16.000Z | src/python/pants/option/config.py | ryanking/pants | e45b00d2eb467b599966bca262405a5d74d27bdd | [
"Apache-2.0"
] | 443 | 2015-01-06T20:17:57.000Z | 2022-03-31T05:28:17.000Z | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import configparser
import getpass
import itertools
import os
import re
from abc import ABC, abstractmethod
from dataclasses import dataclass
from funct... | 35.087379 | 102 | 0.623962 |
from __future__ import annotations
import configparser
import getpass
import itertools
import os
import re
from abc import ABC, abstractmethod
from dataclasses import dataclass
from functools import partial
from hashlib import sha1
from typing import Any, ClassVar, Dict, Iterable, List, Mapping, Sequence, Union, ca... | true | true |
f704a614d6b4bbb4fa96e436b037a80284bc22d8 | 5,226 | py | Python | data_ocean/models.py | Alexandr8854/Data_converter | c5a144477a05ee11849a019bdedecc87f0167a24 | [
"MIT"
] | null | null | null | data_ocean/models.py | Alexandr8854/Data_converter | c5a144477a05ee11849a019bdedecc87f0167a24 | [
"MIT"
] | null | null | null | data_ocean/models.py | Alexandr8854/Data_converter | c5a144477a05ee11849a019bdedecc87f0167a24 | [
"MIT"
] | null | null | null | from django.db import models, connection
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class DataOceanManager(models.Manager):
# exclude soft-deleted objects from queryset
def get_queryset(self):
return super().get_queryset().exclude(deleted_at__isnull=False)... | 37.869565 | 118 | 0.698622 | from django.db import models, connection
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class DataOceanManager(models.Manager):
def get_queryset(self):
return super().get_queryset().exclude(deleted_at__isnull=False)
class DataOceanModel(models.Model):
n... | true | true |
f704a77ad9f0fe607dbc3fdafa7a9c077f619989 | 303 | py | Python | cgi-bin/createPod.py | raktim00/docker-k8s-webapp | 96c1ddd53e3c2a3a1fd1e258c4ee988d1db1bc10 | [
"MIT"
] | 3 | 2021-08-28T15:27:25.000Z | 2021-09-07T21:41:05.000Z | cgi-bin/createPod.py | adyraj/docker-k8s-webapp-1 | 96c1ddd53e3c2a3a1fd1e258c4ee988d1db1bc10 | [
"MIT"
] | null | null | null | cgi-bin/createPod.py | adyraj/docker-k8s-webapp-1 | 96c1ddd53e3c2a3a1fd1e258c4ee988d1db1bc10 | [
"MIT"
] | 7 | 2021-08-28T15:18:46.000Z | 2022-01-20T08:04:12.000Z | #!/usr/bin/python3
print("content-type: text/html")
print()
import cgi
import subprocess
F = cgi.FieldStorage()
pod_name = F.getvalue("podname")
img_name = F.getvalue("imgname")
output = subprocess.getoutput("sudo kubectl run {0} --image={1}".format(pod_name,img_name))
print("<pre>"+ output +"</pre") | 25.25 | 91 | 0.712871 |
print("content-type: text/html")
print()
import cgi
import subprocess
F = cgi.FieldStorage()
pod_name = F.getvalue("podname")
img_name = F.getvalue("imgname")
output = subprocess.getoutput("sudo kubectl run {0} --image={1}".format(pod_name,img_name))
print("<pre>"+ output +"</pre") | true | true |
f704a7bfc8e688c0824f6260a206d405a194c8ee | 1,042 | py | Python | Chapter09/Exercise03/preprocess_data.py | sixhobbits/Data-Storage-for-Artificial-Intelligence | af14abfeb4f091da1dadab5aa6c02801c50e70da | [
"MIT"
] | null | null | null | Chapter09/Exercise03/preprocess_data.py | sixhobbits/Data-Storage-for-Artificial-Intelligence | af14abfeb4f091da1dadab5aa6c02801c50e70da | [
"MIT"
] | null | null | null | Chapter09/Exercise03/preprocess_data.py | sixhobbits/Data-Storage-for-Artificial-Intelligence | af14abfeb4f091da1dadab5aa6c02801c50e70da | [
"MIT"
] | 1 | 2020-11-06T01:45:48.000Z | 2020-11-06T01:45:48.000Z | import argparse
import os
import json
from pathlib import Path
import pandas as pd
def parse_args():
parser = argparse.ArgumentParser(
prog="exercise 3",
description="preprocess meta data")
parser.add_argument('-f', '--file', type=str, required=True, help='meta data file path')
return parse... | 31.575758 | 92 | 0.658349 | import argparse
import os
import json
from pathlib import Path
import pandas as pd
def parse_args():
parser = argparse.ArgumentParser(
prog="exercise 3",
description="preprocess meta data")
parser.add_argument('-f', '--file', type=str, required=True, help='meta data file path')
return parse... | true | true |
f704a9ec0bd0458ff7d4ae73a21677388ae77e92 | 26,104 | py | Python | TensorFlow_implementation/Summary_Generator/Tensorflow_Graph/order_planner_without_copynet.py | shashankk24/natural-language-summary-generation-from-structured-data-master | a8bd083685ff7d5c0228588c47ddfcecba4cf78b | [
"MIT"
] | 187 | 2017-12-16T06:22:52.000Z | 2022-03-13T03:46:55.000Z | TensorFlow_implementation/Summary_Generator/Tensorflow_Graph/order_planner_without_copynet.py | shashankk24/natural-language-summary-generation-from-structured-data-master | a8bd083685ff7d5c0228588c47ddfcecba4cf78b | [
"MIT"
] | 12 | 2017-12-19T08:51:12.000Z | 2021-11-16T18:55:20.000Z | TensorFlow_implementation/Summary_Generator/Tensorflow_Graph/order_planner_without_copynet.py | shashankk24/natural-language-summary-generation-from-structured-data-master | a8bd083685ff7d5c0228588c47ddfcecba4cf78b | [
"MIT"
] | 54 | 2017-12-18T21:52:10.000Z | 2022-01-25T12:51:51.000Z | '''
This file generates the graph of the Model that we are going to use for the order planner for neural summary generator
The function returns the graph object and some of the important handles of the tensors of the graph in a dictionary.
Note, that all the possible tensor handles can be obtained by the tf... | 52.94929 | 132 | 0.57631 |
import tensorflow as tf
def get_computation_graph(seed_value, field_vocab_size, content_label_vocab_size, field_embedding_size,
content_label_embedding_size, lstm_cell_state_size, hidden_state_size, rev_content_label_dict):
tf.reset_default_graph()
graph = tf.Graph()
print("\n\n========... | true | true |
f704aa75697a4476188bfb2d6f8974c30f884072 | 747 | py | Python | info/trace.py | bingpo/dedecmscan | 879470f51a22f1f544b469d80fd2a88d692f116d | [
"Apache-2.0"
] | 751 | 2019-08-16T06:44:25.000Z | 2022-03-30T01:57:53.000Z | info/trace.py | W-Peter/dedecmscan | 42bc196f49e2930490b8f336025540a3d8329e7a | [
"Apache-2.0"
] | 2 | 2019-12-13T12:41:55.000Z | 2020-12-10T07:17:17.000Z | info/trace.py | W-Peter/dedecmscan | 42bc196f49e2930490b8f336025540a3d8329e7a | [
"Apache-2.0"
] | 143 | 2019-08-29T11:26:42.000Z | 2022-03-30T06:54:47.000Z | import requests
from termcolor import cprint
class trace:
def __init__(self,url):
self.url = url
def checktrace(self):
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50"
}
... | 29.88 | 149 | 0.552878 | import requests
from termcolor import cprint
class trace:
def __init__(self,url):
self.url = url
def checktrace(self):
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50"
}
... | true | true |
f704aa9b94fb0781bb3f5a2b471eb94d5c47c9fd | 1,388 | py | Python | projects/SparseRCNN/sparsercnn/config.py | henbucuoshanghai/sparsercnn | 77397aa4abbfeaa55a6be7e5672c05bee05ce442 | [
"MIT"
] | 1 | 2021-03-02T12:29:06.000Z | 2021-03-02T12:29:06.000Z | projects/SparseRCNN/sparsercnn/config.py | henbucuoshanghai/sparsercnn | 77397aa4abbfeaa55a6be7e5672c05bee05ce442 | [
"MIT"
] | null | null | null | projects/SparseRCNN/sparsercnn/config.py | henbucuoshanghai/sparsercnn | 77397aa4abbfeaa55a6be7e5672c05bee05ce442 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Modified by Peize Sun, Rufeng Zhang
# Contact: {sunpeize, cxrfzhang}@foxmail.com
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from detectron2.config import CfgNode as CN
def add_sparsercnn_config(cfg):
"""
Add config for SparseRCNN.
"""
cfg.MODEL... | 28.916667 | 70 | 0.695965 |
from detectron2.config import CfgNode as CN
def add_sparsercnn_config(cfg):
cfg.MODEL.SparseRCNN = CN()
cfg.MODEL.SparseRCNN.NUM_CLASSES = 80
cfg.MODEL.SparseRCNN.NUM_PROPOSALS = 300
cfg.MODEL.SparseRCNN.NHEADS = 8
cfg.MODEL.SparseRCNN.DROPOUT = 0.0
cfg.MODEL.SparseRCNN.DIM_FEEDFOR... | true | true |
f704aab5c4c2780c571cb3901a57f75dfb8b79dd | 2,101 | py | Python | python-client/trustedanalytics/tests/sources.py | skavulya/atk | c83f0bee2530282e39bf28d4a15355561b5eca4d | [
"Apache-2.0"
] | 1 | 2016-04-05T21:57:16.000Z | 2016-04-05T21:57:16.000Z | python-client/trustedanalytics/tests/sources.py | skavulya/atk | c83f0bee2530282e39bf28d4a15355561b5eca4d | [
"Apache-2.0"
] | null | null | null | python-client/trustedanalytics/tests/sources.py | skavulya/atk | c83f0bee2530282e39bf28d4a15355561b5eca4d | [
"Apache-2.0"
] | null | null | null | # vim: set encoding=utf-8
#
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 35.016667 | 106 | 0.653974 |
from collections import OrderedDict
class SimpleDataSource(object):
annotation = "simple"
def __init__(self, schema=None, rows=None, columns=None):
if not ((rows is None) ^ (columns is None)):
raise ValueError("Either rows or columns must be supplied")
if schema ... | true | true |
f704ab5ed7d678270f10502450721a8718967912 | 655 | py | Python | eeg_ml/data_loader/data_loaders.py | adam2392/eeg_ml | 374786526d7a51e9b9cf94822f045fd5b90858cb | [
"MIT"
] | null | null | null | eeg_ml/data_loader/data_loaders.py | adam2392/eeg_ml | 374786526d7a51e9b9cf94822f045fd5b90858cb | [
"MIT"
] | null | null | null | eeg_ml/data_loader/data_loaders.py | adam2392/eeg_ml | 374786526d7a51e9b9cf94822f045fd5b90858cb | [
"MIT"
] | null | null | null | from torchvision import datasets, transforms
from eeg_ml.base import BaseDataLoader
class MnistDataLoader(BaseDataLoader):
"""
MNIST data loading demo using BaseDataLoader
"""
def __init__(self, data_dir, batch_size, shuffle, validation_split, num_workers, training=True):
trsfm = transforms.C... | 36.388889 | 100 | 0.69771 | from torchvision import datasets, transforms
from eeg_ml.base import BaseDataLoader
class MnistDataLoader(BaseDataLoader):
def __init__(self, data_dir, batch_size, shuffle, validation_split, num_workers, training=True):
trsfm = transforms.Compose([
transforms.ToTensor(),
transform... | true | true |
f704abbec2b1b78577eaaa6369b7fcc9f2ab225f | 1,632 | py | Python | alttprbot/tournament/sgl21/twwr.py | skyscooby/sahasrahbot | 16fce824bd024f6357a8f260e2447ba477dcdac2 | [
"MIT"
] | null | null | null | alttprbot/tournament/sgl21/twwr.py | skyscooby/sahasrahbot | 16fce824bd024f6357a8f260e2447ba477dcdac2 | [
"MIT"
] | null | null | null | alttprbot/tournament/sgl21/twwr.py | skyscooby/sahasrahbot | 16fce824bd024f6357a8f260e2447ba477dcdac2 | [
"MIT"
] | null | null | null | import os
from alttprbot.tournament.core import TournamentConfig
from alttprbot_discord.bot import discordbot
from .sglcore import SGLCoreTournamentRace
class TWWR(SGLCoreTournamentRace):
async def configuration(self):
guild = discordbot.get_guild(590331405624410116)
return TournamentConfig(
... | 30.792453 | 74 | 0.624387 | import os
from alttprbot.tournament.core import TournamentConfig
from alttprbot_discord.bot import discordbot
from .sglcore import SGLCoreTournamentRace
class TWWR(SGLCoreTournamentRace):
async def configuration(self):
guild = discordbot.get_guild(590331405624410116)
return TournamentConfig(
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.