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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3a66f6b02d61600747710a4b6d9b3fe30d5a5e | 7,734 | py | Python | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | import logging
from datetime import datetime, timezone
import discord
from discord.ext import commands, tasks
from helpers import checks
from pymongo import UpdateOne
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
class Logging(commands.Cog):
"""For logging."""
def __init_... | 35.805556 | 115 | 0.604603 | import logging
from datetime import datetime, timezone
import discord
from discord.ext import commands, tasks
from helpers import checks
from pymongo import UpdateOne
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
class Logging(commands.Cog):
def __init__(self, bot):
s... | true | true |
1c3a67f764910581a850d71f3429daa017619b4d | 748 | py | Python | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 13 | 2019-03-24T13:56:13.000Z | 2022-03-19T23:18:42.000Z | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 2 | 2020-04-18T13:04:06.000Z | 2020-05-18T19:54:32.000Z | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 27 | 2019-03-24T13:56:16.000Z | 2022-03-19T23:18:44.000Z | #!/bin/python3
import sys
from functools import reduce
from math import gcd
'''
1) Find the gcd G of the second set
2) Find the lcm L of the first set
3) Find the divisors D of G
4) The result is the number of times that an element of D is divisible by L
'''
if __name__ == "__main__":
n, m = ma... | 31.166667 | 91 | 0.641711 |
import sys
from functools import reduce
from math import gcd
if __name__ == "__main__":
n, m = map(int, input().strip().split(' '))
first_set = list(map(int, input().strip().split(' ')))
second_set = list(map(int, input().strip().split(' ')))
gcd_value = reduce(gcd, second_set)
lcm_value = redu... | true | true |
1c3a682dc1fa384b56a768b52ec6da74b3c2ef6c | 2,758 | py | Python | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | import csv
import pandas
class Homework():
BAD_NAME_FILE_SUFIX = '-wrong-name.txt'
CHECK_FILE_NAME = 'check.txt'
FRAUD_MESSAGE = 'FRAUD'
GOOD_MESSAGE = 'GOOD'
WRONG_MESSAGE = 'WRONG'
NOT_SENT_MESSAGE = 'NOT SENT'
def __init__(self, title, student_list, path_list):
self.... | 43.09375 | 86 | 0.602973 | import csv
import pandas
class Homework():
BAD_NAME_FILE_SUFIX = '-wrong-name.txt'
CHECK_FILE_NAME = 'check.txt'
FRAUD_MESSAGE = 'FRAUD'
GOOD_MESSAGE = 'GOOD'
WRONG_MESSAGE = 'WRONG'
NOT_SENT_MESSAGE = 'NOT SENT'
def __init__(self, title, student_list, path_list):
self.... | true | true |
1c3a687f897f4b8336c532c52d749853e57c12dd | 3,182 | py | Python | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | 36 | 2016-01-01T08:58:20.000Z | 2021-09-22T18:54:51.000Z | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | null | null | null | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | 7 | 2016-09-29T20:15:33.000Z | 2019-02-17T13:25:05.000Z | # -*- coding: utf-8 -*-
from __future__ import print_function
from collections import defaultdict
import sys
import time
from pattern.text.de import split, parse
from libleipzig import Baseform
from suds import WebFault
LIBLEIPZIG_FOR_LEMMATA = True
LIBLEIPZIG_FAIL_RETRIES = 10
LIBLEIPZIG_FAIL_RETRIES_SLEEP_SEC = 1
... | 39.775 | 117 | 0.574167 | from __future__ import print_function
from collections import defaultdict
import sys
import time
from pattern.text.de import split, parse
from libleipzig import Baseform
from suds import WebFault
LIBLEIPZIG_FOR_LEMMATA = True
LIBLEIPZIG_FAIL_RETRIES = 10
LIBLEIPZIG_FAIL_RETRIES_SLEEP_SEC = 1
STRINGS_STARTWITH_BLACKL... | true | true |
1c3a6a7a4d34c73b925f73b27932c4f907271fe1 | 23,157 | py | Python | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 33.56087 | 90 | 0.651509 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from collections import Iterable
from multiprocessing import pool
from multiprocessing import Queue
import gfootball
import os
import random
import threading
import zlib... | true | true |
1c3a6a9a3af4da22510834166c0e0f9ba885cfff | 451 | py | Python | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | 1 | 2017-12-21T11:44:05.000Z | 2017-12-21T11:44:05.000Z | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | null | null | null | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | 2 | 2016-10-31T19:25:21.000Z | 2017-02-07T08:40:10.000Z | #!/usr/bin/env python
from flask import Flask, render_template
import redis
app = Flask(__name__)
app.config['DEBUG'] = True
redis = redis.Redis("redis")
@app.route("/")
def index():
count = 1
bcount = redis.get('count')
if bcount:
count = int(bcount.decode('utf8')) + 1
redis.set('count', str... | 20.5 | 53 | 0.643016 | from flask import Flask, render_template
import redis
app = Flask(__name__)
app.config['DEBUG'] = True
redis = redis.Redis("redis")
@app.route("/")
def index():
count = 1
bcount = redis.get('count')
if bcount:
count = int(bcount.decode('utf8')) + 1
redis.set('count', str(count))
return r... | true | true |
1c3a6b5b139ff6ab035e2f38e7979eb6bdf13b68 | 2,189 | py | Python | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 3 | 2019-12-23T13:16:39.000Z | 2022-01-29T23:45:31.000Z | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 2 | 2021-11-01T15:02:37.000Z | 2022-01-17T14:34:36.000Z | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 1 | 2019-12-24T02:07:46.000Z | 2019-12-24T02:07:46.000Z | #!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import sys
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
from sim.stats import ExecutionStatAnalyzer... | 29.186667 | 78 | 0.628141 |
import argparse
import sys
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
from sim.stats import ExecutionStatAnalyzer
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('elf')
parser.add_argument('-v', '--verbose', action='store_true')
parser.add... | true | true |
1c3a6c34a77463d37ec1c647937a7811b2ba42e0 | 1,168 | py | Python | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | 1 | 2018-11-01T03:36:17.000Z | 2018-11-01T03:36:17.000Z | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | null | null | null | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | 20 | 2018-10-26T14:46:35.000Z | 2020-10-18T05:27:18.000Z | # Generated by Django 2.1.1 on 2018-10-22 19:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Album',
fields=[
... | 33.371429 | 114 | 0.57363 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Album',
fields=[
('id', models.AutoField(auto_created=True... | true | true |
1c3a6e1dd73a95a1331e02a93814d1f2befb97ed | 495 | py | Python | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 13 | 2020-10-22T05:12:27.000Z | 2022-01-10T10:59:10.000Z | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 2 | 2020-10-25T19:34:18.000Z | 2020-11-03T19:02:22.000Z | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 7 | 2020-10-25T18:53:09.000Z | 2020-12-25T03:15:03.000Z | # Question
# 25. Write a program to reverse a list of integers
# Code
x = []
while True:
print("int",str(len(x)+1)+ ':')
i = input()
if i != 'n' and i.strip().replace(' ','') != '' and i.isdigit():
x.append(int(i))
else: break
y = []
for e in x: y.insert(0, e)
print("New list:",y)
# Input
# ... | 17.678571 | 68 | 0.537374 |
x = []
while True:
print("int",str(len(x)+1)+ ':')
i = input()
if i != 'n' and i.strip().replace(' ','') != '' and i.isdigit():
x.append(int(i))
else: break
y = []
for e in x: y.insert(0, e)
print("New list:",y)
| true | true |
1c3a6e7165a7f68e70a893ebe3220424c741e6f8 | 597 | py | Python | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | """
WSGI config for main 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/1.6/howto/deployment/wsgi/
"""
from main.boot import fix_path
fix_path()
import os
from django.core.wsgi import get_wsgi_applicat... | 25.956522 | 78 | 0.802345 |
from main.boot import fix_path
fix_path()
import os
from django.core.wsgi import get_wsgi_application
from djangae.wsgi import DjangaeApplication
from djangae.utils import on_production
settings = "main.settings_live" if on_production() else "main.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
... | true | true |
1c3a70203a0e47efd5e2100f9a6d2d8afa00b562 | 285 | py | Python | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | from django.conf.urls import include, url
from . import views
app_name = "research"
urlpatterns = [
url(r"^search/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.SearchView.as_view()),
url(r"^detail/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.DetailView.as_view()),
]
| 25.909091 | 89 | 0.617544 | from django.conf.urls import include, url
from . import views
app_name = "research"
urlpatterns = [
url(r"^search/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.SearchView.as_view()),
url(r"^detail/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.DetailView.as_view()),
]
| true | true |
1c3a720c40fef0a082fb59e93c915bf4bc93a166 | 2,394 | py | Python | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | null | null | null | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | 49 | 2021-11-11T16:00:40.000Z | 2021-11-24T15:37:34.000Z | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | null | null | null | import pytest
try:
from unittest.mock import AsyncMock as CoroutineMock, patch
except ImportError:
from asynctest import CoroutineMock, patch
from aioalfacrm import AlfaClient
def add_auth_request(aresponses):
aresponses.add('demo.s20.online', '/v2api/auth/login', 'POST', {'token': 'api-token'})
@pyte... | 26.021739 | 118 | 0.639515 | import pytest
try:
from unittest.mock import AsyncMock as CoroutineMock, patch
except ImportError:
from asynctest import CoroutineMock, patch
from aioalfacrm import AlfaClient
def add_auth_request(aresponses):
aresponses.add('demo.s20.online', '/v2api/auth/login', 'POST', {'token': 'api-token'})
@pyte... | true | true |
1c3a72806bd68dbefacd821759f72754e6c94a7f | 905 | py | Python | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | 1 | 2020-05-27T07:07:58.000Z | 2020-05-27T07:07:58.000Z | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | null | null | null | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | null | null | null | import logging
import numpy as np
from rastervision2.core.rv_pipeline.rv_pipeline import RVPipeline
from rastervision2.core.box import Box
log = logging.getLogger(__name__)
def get_train_windows(scene, chip_size):
train_windows = []
extent = scene.raster_source.get_extent()
stride = chip_size
windo... | 29.193548 | 72 | 0.738122 | import logging
import numpy as np
from rastervision2.core.rv_pipeline.rv_pipeline import RVPipeline
from rastervision2.core.box import Box
log = logging.getLogger(__name__)
def get_train_windows(scene, chip_size):
train_windows = []
extent = scene.raster_source.get_extent()
stride = chip_size
windo... | true | true |
1c3a74dca3d84a11503553d986e556a6ac3ec2ed | 2,877 | py | Python | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | from __future__ import print_function
import argparse
import logging
import sys
from pathlib import Path
from typing import Dict
from s3pypi import __prog__, __version__, core
logging.basicConfig()
log = logging.getLogger(__prog__)
def string_dict(text: str) -> Dict[str, str]:
return dict(tuple(item.strip().sp... | 34.662651 | 107 | 0.635732 | from __future__ import print_function
import argparse
import logging
import sys
from pathlib import Path
from typing import Dict
from s3pypi import __prog__, __version__, core
logging.basicConfig()
log = logging.getLogger(__prog__)
def string_dict(text: str) -> Dict[str, str]:
return dict(tuple(item.strip().sp... | true | true |
1c3a75ba491a649ac5339b068c1a2c8baaf61bf3 | 4,048 | py | Python | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | import numpy as np
from numpy.random import randn, randint
import matplotlib.pyplot as plt
from psda import VMF, PSDA, decompose, atleast2
from pyllr import quick_eval
"""
This demo uses a quick-and-dirty data simulator, using Gaussians, not VMF.
It does not work for high dimensions. But you can play with dim = 2 or ... | 26.457516 | 85 | 0.693182 | import numpy as np
from numpy.random import randn, randint
import matplotlib.pyplot as plt
from psda import VMF, PSDA, decompose, atleast2
from pyllr import quick_eval
dim = 20
b, w = 10, 50
ns = 100 n = 1000
norm, mu = decompose(randn(dim))
model0 = PSDA(w, VMF(mu, b))
Z = model0.sample_speakers(ns)
labels = ... | true | true |
1c3a763bfa27750340ecc34c91ff0be3c4d675bc | 815 | py | Python | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 33 | 2017-12-02T04:09:24.000Z | 2021-11-07T08:41:57.000Z | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 189 | 2017-11-16T04:06:29.000Z | 2022-03-11T23:35:59.000Z | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 30 | 2017-11-30T03:35:44.000Z | 2022-01-31T03:08:08.000Z | # Generated by Django 2.2.8 on 2019-12-29 22:07
from django.db import migrations
def move_excluded_items_to_payload(apps, schema_editor):
if schema_editor.connection.alias != 'default':
return
# Traverse the scheduled actions and move the exclude_items field from
# the object field to the payloa... | 28.103448 | 74 | 0.694479 |
from django.db import migrations
def move_excluded_items_to_payload(apps, schema_editor):
if schema_editor.connection.alias != 'default':
return
ScheduledOperation = apps.get_model('ontask', 'ScheduledOperation')
for item in ScheduledOperation.objects.all():
if item.exclude_value... | true | true |
1c3a7688b9e25e9cb16c6b395e6dfd222433496f | 5,442 | py | Python | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | 1 | 2021-05-19T10:27:59.000Z | 2021-05-19T10:27:59.000Z | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | null | null | null | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | null | null | null | import numpy as np
from itertools import product
import plotly.graph_objects as go
class Parallelepiped:
"""
Class to build and draw a Parallelepiped.
...
Attributes
----------
L : float or numpy array
x, y, z lengths of the parallelepiped sides. If float, a cube of
side L i... | 29.901099 | 77 | 0.534546 | import numpy as np
from itertools import product
import plotly.graph_objects as go
class Parallelepiped:
def __init__(
self,
L,
initial_vertex_position=[0, 0, 0],
edge_color="black",
edge_width=2,
face_opacity=0,
):
if isinstance(L, (list, np.ndarray))... | true | true |
1c3a76a7ee7ba27b5033d6a016d79217d35b84e6 | 1,265 | py | Python | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | 9 | 2021-02-23T13:49:11.000Z | 2022-03-27T20:52:16.000Z | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | null | null | null | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | null | null | null | from unittest.mock import ANY, Mock
import pytest
from application.services.booking_table import BookingTableApplicationService
from domain.commands import BookTableCommand
from domain.events.table import BookedTableEvent
from infrastructure.db.memory.repository import MemoryRestaurantRepository
from infrastructure.d... | 30.119048 | 86 | 0.765217 | from unittest.mock import ANY, Mock
import pytest
from application.services.booking_table import BookingTableApplicationService
from domain.commands import BookTableCommand
from domain.events.table import BookedTableEvent
from infrastructure.db.memory.repository import MemoryRestaurantRepository
from infrastructure.d... | true | true |
1c3a76aa4aed1ee5ba205b4f9f05ac25c089bb24 | 1,259 | py | Python | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 126 | 2017-07-27T16:19:56.000Z | 2021-11-26T22:10:49.000Z | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 26 | 2017-07-30T11:38:40.000Z | 2021-09-11T15:24:04.000Z | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 9 | 2018-04-03T22:07:35.000Z | 2020-04-30T18:21:32.000Z | # -*- coding: utf-8 -*-
#
# Copyright 2019, Rambler Digital Solutions
#
# 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 app... | 27.977778 | 82 | 0.743447 |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import airflow_declarative
from airflow_declarative.operators import GenericOperator
@pytest.fixture()
def dag(good_dag_path):
path = good_dag_path("template-with-from-stdout")
dags = airflow_declarative.from_p... | true | true |
1c3a77fad5ceaaf2111e691cb0200c1c25872ebc | 1,339 | py | Python | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | 1 | 2021-01-03T00:57:53.000Z | 2021-01-03T00:57:53.000Z | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | null | null | null | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | 1 | 2019-06-14T10:40:54.000Z | 2019-06-14T10:40:54.000Z | from unittest import TestCase
from vibora.schemas.fields import String
from vibora.schemas.exceptions import ValidationError
class StringTestCase(TestCase):
def test_default__expects_successful(self):
field = String()
self.assertEqual('Test', field.load('Test'))
def test_default_with_integer... | 31.880952 | 66 | 0.681105 | from unittest import TestCase
from vibora.schemas.fields import String
from vibora.schemas.exceptions import ValidationError
class StringTestCase(TestCase):
def test_default__expects_successful(self):
field = String()
self.assertEqual('Test', field.load('Test'))
def test_default_with_integer... | true | true |
1c3a787bd0e947f8f10a5d680d6a48e3995cf9bd | 3,241 | py | Python | examples/src/main/python/als.py | dongwang218/spark | 48fc38f5844f6c12bf440f2990b6d7f1630fafac | [
"Apache-2.0",
"MIT"
] | 5 | 2017-04-13T01:00:13.000Z | 2020-01-02T06:38:49.000Z | examples/src/main/python/als.py | newscred/spark | 257236c3e17906098f801cbc2059e7a9054e8cab | [
"Apache-2.0",
"MIT"
] | 9 | 2015-09-25T20:21:52.000Z | 2020-02-04T18:25:21.000Z | examples/src/main/python/als.py | newscred/spark | 257236c3e17906098f801cbc2059e7a9054e8cab | [
"Apache-2.0",
"MIT"
] | 15 | 2017-01-12T10:41:50.000Z | 2019-04-19T08:28:15.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 31.466019 | 87 | 0.636223 |
from __future__ import print_function
import sys
import numpy as np
from numpy.random import rand
from numpy import matrix
from pyspark import SparkContext
LAMBDA = 0.01 np.random.seed(42)
def rmse(R, ms, us):
diff = R - ms * us.T
return np.sqrt(np.sum(np.power(diff, 2)) / M * U)
def update(i, vec, ma... | true | true |
1c3a793e81bc992bc5a1a1ed4247323dd86194f0 | 37,914 | py | Python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2019-05-17T21:24:53.000Z | 2020-02-12T11:13:42.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 15 | 2019-07-12T18:18:04.000Z | 2019-07-25T20:55:51.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 47.098137 | 190 | 0.65638 | from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineRespo... | true | true |
1c3a796b2699601f424e3f80a5837fc28a6713db | 16,434 | py | Python | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | null | null | null | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | null | null | null | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | 53 | 2022-01-11T19:06:06.000Z | 2022-03-25T19:27:48.000Z | # Databricks notebook source
# MAGIC %md
# MAGIC # Model Registry
# MAGIC
# MAGIC MLflow Model Registry is a collaborative hub where teams can share ML models, work together from experimentation to online testing and production, integrate with approval and governance workflows, and monitor ML deployments and their per... | 37.692661 | 645 | 0.73141 |
from distutils.version import LooseVersion, StrictVersion
import mlflow
assert StrictVersion(mlflow.__version__) >= StrictVersion("1.7.0"), "Update MLflow to version 1.7.0+"
import mlflow
import mlflow.sklearn
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics ... | true | true |
1c3a7ac01ca66454f09348069e9fb311bffde81f | 2,350 | py | Python | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 138 | 2020-09-22T14:59:52.000Z | 2022-03-30T18:43:41.000Z | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 58 | 2020-11-19T11:41:21.000Z | 2022-03-31T17:54:46.000Z | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 24 | 2020-09-28T02:35:55.000Z | 2022-03-14T12:51:40.000Z | # -*- coding: utf-8 -*-
import multiprocessing
import os
import shutil
import unittest
import torch
from comet.models import RankingMetric
from pytorch_lightning import seed_everything
from pytorch_lightning.trainer.trainer import Trainer
from scipy.stats import pearsonr
from tests.data import DATA_PATH
from torch.uti... | 31.756757 | 87 | 0.611064 | import multiprocessing
import os
import shutil
import unittest
import torch
from comet.models import RankingMetric
from pytorch_lightning import seed_everything
from pytorch_lightning.trainer.trainer import Trainer
from scipy.stats import pearsonr
from tests.data import DATA_PATH
from torch.utils.data import DataLoade... | true | true |
1c3a7b6a2dbdfcc7a6cb2655d83c8b91264b42c6 | 2,072 | py | Python | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | null | null | null | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | 5 | 2021-06-08T22:20:20.000Z | 2022-03-12T00:46:52.000Z | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | null | null | null | import numpy as np
import torch
from torch import nn
from torch.backends import cudnn
from torch.utils.data import DataLoader
import torchvision
import matplotlib.pyplot as plt
from shallow_autoenc import Autoencoder
from autoencoder_dataset import Dataset
# CUDA for PyTorch
use_cuda = torch.cuda.is_available()
device... | 28.383562 | 102 | 0.681467 | import numpy as np
import torch
from torch import nn
from torch.backends import cudnn
from torch.utils.data import DataLoader
import torchvision
import matplotlib.pyplot as plt
from shallow_autoenc import Autoencoder
from autoencoder_dataset import Dataset
use_cuda = torch.cuda.is_available()
device = torch.device("cu... | true | true |
1c3a7c87a6d25531d0ab33c8faa31b4f10e373f5 | 1,089 | py | Python | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | 1 | 2021-05-01T02:25:27.000Z | 2021-05-01T02:25:27.000Z | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | null | null | null | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | null | null | null | from quart import Request as BaseRequest
from typing import Optional
from api.models import User
class Request(BaseRequest):
"""Custom request class to implement authorization."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._user = None
self.__has_fet... | 24.2 | 73 | 0.615243 | from quart import Request as BaseRequest
from typing import Optional
from api.models import User
class Request(BaseRequest):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._user = None
self.__has_fetched = False
@property
def is_authorized(self) -> ... | true | true |
1c3a7c92dba7f63865dc2773147c67d25a7863b8 | 1,320 | py | Python | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | from torch.utils.data import DataLoader
from data_loader.dataset.bcic4_2a import BCIC4_2A
class DataGenerator:
def __init__(self, args):
print("[Load Data]")
if args.mode == 'train':
self.train_loader = self.__data_loader(args, 'train')
self.val_loader = self.__data_loader... | 42.580645 | 89 | 0.609091 | from torch.utils.data import DataLoader
from data_loader.dataset.bcic4_2a import BCIC4_2A
class DataGenerator:
def __init__(self, args):
print("[Load Data]")
if args.mode == 'train':
self.train_loader = self.__data_loader(args, 'train')
self.val_loader = self.__data_loader... | true | true |
1c3a7e2f81ccaf710e9ab7d0d3e2a280f179d8b8 | 1,394 | py | Python | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | 3 | 2020-02-09T23:25:37.000Z | 2021-01-19T09:44:12.000Z | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | null | null | null | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | 2 | 2020-04-18T16:24:39.000Z | 2021-01-19T09:42:19.000Z | """
Copyright (c) 2018-2019 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 i... | 23.233333 | 73 | 0.713056 |
import numpy as np
from extensions.ops.gather import Gather
from mo.front.extractor import FrontExtractorOp
class GatherFrontExtractor(FrontExtractorOp):
op = 'Gather'
enabled = True
@staticmethod
def extract(node):
attrs = {}
Gather.update_node_stat(node, attrs)
return __... | true | true |
1c3a7e35403f792a0cf1f5ff099da7a89b4cec8c | 4,974 | py | Python | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 17 | 2020-06-10T23:33:11.000Z | 2021-01-02T20:38:25.000Z | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 24 | 2020-03-25T19:35:43.000Z | 2022-02-10T11:46:50.000Z | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 11 | 2019-01-21T17:51:48.000Z | 2021-08-10T07:04:33.000Z | """
Parser for the Telnet protocol. (Not a complete implementation of the telnet
specification, but sufficient for a command line interface.)
Inspired by `Twisted.conch.telnet`.
"""
import struct
from typing import Callable, Generator
from .log import logger
__all__ = [
"TelnetProtocolParser",
]
def int2byte(n... | 26.31746 | 76 | 0.533374 | import struct
from typing import Callable, Generator
from .log import logger
__all__ = [
"TelnetProtocolParser",
]
def int2byte(number: int) -> bytes:
return bytes((number,))
NOP = int2byte(0)
SGA = int2byte(3)
IAC = int2byte(255)
DO = int2byte(253)
DONT = int2byte(254)
LINEMODE = int2byte(34)
SB = int2b... | true | true |
1c3a7e4c47599ec3fd2482ae33f5943bbbc4669d | 480 | py | Python | appengine/chromium_try_flakes/issue_tracker/utils.py | mithro/chromium-infra | d27ac0b230bedae4bc968515b02927cf9e17c2b7 | [
"BSD-3-Clause"
] | 2 | 2021-04-13T21:22:18.000Z | 2021-09-07T02:11:57.000Z | appengine/chromium_try_flakes/issue_tracker/utils.py | mithro/chromium-infra | d27ac0b230bedae4bc968515b02927cf9e17c2b7 | [
"BSD-3-Clause"
] | 21 | 2020-09-06T02:41:05.000Z | 2022-03-02T04:40:01.000Z | appengine/third_party/monorail_api/utils.py | NDevTK/chromium-infra | d38e088e158d81f7f2065a38aa1ea1894f735ec4 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions"""
import datetime
def parseDateTime(dt_str):
if dt_str is None:
return None
dt, _, us = dt_str.partition(".")
dt = datetime... | 25.263158 | 72 | 0.68125 |
import datetime
def parseDateTime(dt_str):
if dt_str is None:
return None
dt, _, us = dt_str.partition(".")
dt = datetime.datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S")
if us:
us = int(us.rstrip("Z"), 10)
return dt + datetime.timedelta(microseconds=us)
else:
return dt
| true | true |
1c3a7ffbe112c0b6aa9e4322f1d64df0ef549c64 | 20,637 | py | Python | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | 4 | 2018-12-02T20:37:44.000Z | 2019-01-15T17:43:29.000Z | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | null | null | null | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | null | null | null | #######################################################################################################################
#
# AppleCare Connect API Library Python 3.x Module
#
# Overview
# The purpose of this Python module is to provide a standard Python module to interact with the AppleCare Connect API.
# Each method i... | 44.285408 | 120 | 0.657024 |
import json
import os
import requests
def acc_credentials():
session = requests.Session()
session.headers.update({'Content-Type': "application/json;charset=utf-8"})
acc_ship_to = os.environ['ACC_SHIPTO'] acc_env = os.environ['ACC_ENV']
base_url = "https://acc-ipt.apple.com/or... | true | true |
1c3a8105ce41b9b0a4cec6739e683ef2e18381b7 | 1,082 | py | Python | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 15 | 2017-03-01T17:08:20.000Z | 2021-03-18T15:32:02.000Z | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 15 | 2017-03-07T16:21:38.000Z | 2021-04-06T14:28:04.000Z | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 7 | 2017-12-06T12:00:31.000Z | 2021-12-21T03:53:19.000Z | # -*- coding: utf-8 -*-
import logging
import os
import sys
from .helpers.logger import logger
from .helpers.logger import logger_setup
from .helpers.cmd import init_cmd
from .helpers.exceptions import UserDockerException
from .helpers.execute import exit_exec_cmd
from .parser import parse_args
from .subcommands imp... | 23.521739 | 65 | 0.713494 |
import logging
import os
import sys
from .helpers.logger import logger
from .helpers.logger import logger_setup
from .helpers.cmd import init_cmd
from .helpers.exceptions import UserDockerException
from .helpers.execute import exit_exec_cmd
from .parser import parse_args
from .subcommands import specific_command_exe... | true | true |
1c3a812258ec9a355328f15ed21b91f54a184eaa | 654 | py | Python | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | vl=input().split()
A=float(vl[0])
B=float(vl[1])
C=float(vl[2])
if B>A:
aux=B;B=A;A=aux
if C>A:
aux=C;C=A;A=aux
if C>B:
aux=C;C=B;B=aux
if C>A:
aux=C;C=A;A=aux
if B>A:
aux=B;B=A;A=aux
if C>B:
aux=C;C=B;B=aux
print("%.1f %.1f %.1f" %(A,B,C))
if A>=(B+C):
print("NAO FORMA... | 19.235294 | 46 | 0.513761 | vl=input().split()
A=float(vl[0])
B=float(vl[1])
C=float(vl[2])
if B>A:
aux=B;B=A;A=aux
if C>A:
aux=C;C=A;A=aux
if C>B:
aux=C;C=B;B=aux
if C>A:
aux=C;C=A;A=aux
if B>A:
aux=B;B=A;A=aux
if C>B:
aux=C;C=B;B=aux
print("%.1f %.1f %.1f" %(A,B,C))
if A>=(B+C):
print("NAO FORMA... | true | true |
1c3a81c0fe73e0b3a9110d9fcf0740d103e34d93 | 381 | py | Python | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | 1 | 2021-10-30T03:55:24.000Z | 2021-10-30T03:55:24.000Z | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | null | null | null | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | null | null | null | """
Layered Bar Chart
-----------------
This example shows a segmented bar chart that is layered rather than stacked.
"""
# category: bar charts
import altair as alt
from vega_datasets import data
source = data.iowa_electricity()
(
alt.Chart(source)
.mark_bar(opacity=0.7)
.encode(
x="year:O", y=al... | 20.052632 | 77 | 0.653543 | import altair as alt
from vega_datasets import data
source = data.iowa_electricity()
(
alt.Chart(source)
.mark_bar(opacity=0.7)
.encode(
x="year:O", y=alt.Y("net_generation:Q", stack=None), color="source",
)
)
| true | true |
1c3a8208ad35a4ea36b511d1167fb073a1043820 | 5,503 | py | Python | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | import functools
import logging
from typing import Any, Callable, Dict, Optional
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.utils.module_loading import import_string
from .exceptions import ConnectionInterrupted, Pick... | 30.236264 | 84 | 0.644376 | import functools
import logging
from typing import Any, Callable, Dict, Optional
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.utils.module_loading import import_string
from .exceptions import ConnectionInterrupted, Pick... | true | true |
1c3a84bbaa43a9a2f21d753c51547195f7daa84d | 577 | py | Python | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | 1 | 2021-07-07T00:55:23.000Z | 2021-07-07T00:55:23.000Z | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | null | null | null | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | null | null | null | from collections import defaultdict
from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
complement_dict = defaultdict(int)
for i, num in enumerate(nums):
if target - num in complement_dict:
return [complement_dict[target... | 25.086957 | 82 | 0.663778 | from collections import defaultdict
from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
complement_dict = defaultdict(int)
for i, num in enumerate(nums):
if target - num in complement_dict:
return [complement_dict[target... | true | true |
1c3a84f933c71f07c6fcdbe25450625810daa097 | 3,173 | py | Python | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | from torchvision.utils import make_grid
import matplotlib.pyplot as plt
import argparse
import os
import torch
from Data import *
################################################################################
############################## UTILITY FUNCTIONS ###############################
##########################... | 32.71134 | 116 | 0.57359 | from torchvision.utils import make_grid
import matplotlib.pyplot as plt
import argparse
import os
import torch
from Data import *
def show_tensor_images(image_tensor, num_images=25, size=(1, 28, 28)):
image_tensor_unflat = image_tensor.detach().cpu().view(-1, *size)
image_grid = make_grid(i... | true | true |
1c3a850cb701d562f7d1a3c856e13af69a80f58d | 1,999 | py | Python | src/data_gen/ohem.py | kehuaWangfff/FashionAI_KeyPoint_Detection_Challenge_Keras | 02422f315403fae4dcd87abf90b08ae9183d75f0 | [
"MIT"
] | 169 | 2018-05-24T08:22:03.000Z | 2022-02-02T15:25:17.000Z | src/data_gen/ohem.py | Koeru/FashionAI_KeyPoint_Detection_Challenge_Keras | 0b3bd8cdee32e05619300e5466578644974279df | [
"MIT"
] | 12 | 2018-05-29T15:40:50.000Z | 2021-11-17T07:35:21.000Z | src/data_gen/ohem.py | Koeru/FashionAI_KeyPoint_Detection_Challenge_Keras | 0b3bd8cdee32e05619300e5466578644974279df | [
"MIT"
] | 54 | 2018-05-25T13:57:42.000Z | 2022-02-08T03:00:07.000Z |
import sys
sys.path.insert(0, "../unet/")
from keras.models import *
from keras.layers import *
from utils import np_euclidean_l2
from dataset import getKpNum
def generate_topk_mask_ohem(input_data, gthmap, keras_model, graph, topK, image_category, dynamicFlag=False):
'''
:param input_data: input
:param ... | 27.383562 | 109 | 0.63932 |
import sys
sys.path.insert(0, "../unet/")
from keras.models import *
from keras.layers import *
from utils import np_euclidean_l2
from dataset import getKpNum
def generate_topk_mask_ohem(input_data, gthmap, keras_model, graph, topK, image_category, dynamicFlag=False):
mimg, mmask = input_data
ximg = mi... | true | true |
1c3a864ae8eabfe2c5b0f38f8dad8915a9ad63fe | 918 | py | Python | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | 4 | 2021-09-18T13:32:57.000Z | 2022-03-15T22:13:56.000Z | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | null | null | null | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | 2 | 2021-12-06T20:19:04.000Z | 2022-03-15T22:13:58.000Z | '''
Edges in a block diagram computational graph. The edges themselves don't have direction,
but the ports that they attach to may.
'''
class WireConnection:
pass
class NamedConnection(WireConnection):
def __init__(self, target_uid: int, target_port: str):
self.target_uid = target_uid
self.t... | 24.810811 | 95 | 0.686275 |
class WireConnection:
pass
class NamedConnection(WireConnection):
def __init__(self, target_uid: int, target_port: str):
self.target_uid = target_uid
self.target_port = target_port
def __str__(self):
return f'NamedConnection(id={self.target_uid}, port={self.target_port})'
clas... | true | true |
1c3a86c8aa044f75d9b0a9d1eb1b70c3f380d689 | 8,071 | py | Python | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | import datetime
import discord
import os
import random
import re
import string
from discord.ext import commands
from sys import argv
class Extras:
"""
Extra things.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
prune_key = "n... | 42.478947 | 225 | 0.61752 | import datetime
import discord
import os
import random
import re
import string
from discord.ext import commands
from sys import argv
class Extras:
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
prune_key = "nokey"
@commands.command()
... | true | true |
1c3a87252df33ddf8d8ca65308e4c22681cf4307 | 286 | py | Python | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | null | null | null | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | 4 | 2018-02-21T11:25:49.000Z | 2018-06-23T15:51:51.000Z | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | null | null | null | import telegram.ext as tg
from .commands import commands
def create_updater(token):
updater = tg.Updater(token=token)
for command in commands:
handler = tg.CommandHandler(command.__name__, command)
updater.dispatcher.add_handler(handler)
return updater
| 20.428571 | 62 | 0.727273 | import telegram.ext as tg
from .commands import commands
def create_updater(token):
updater = tg.Updater(token=token)
for command in commands:
handler = tg.CommandHandler(command.__name__, command)
updater.dispatcher.add_handler(handler)
return updater
| true | true |
1c3a8743e8a520f7f7fa08e01d17d42fc8701986 | 1,594 | py | Python | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 157 | 2017-09-28T12:16:52.000Z | 2022-03-31T08:13:23.000Z | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 43 | 2017-11-01T19:21:21.000Z | 2022-03-27T08:36:56.000Z | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 12 | 2018-01-14T08:05:07.000Z | 2021-07-31T05:15:38.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# The MIT License
# Copyright (c) 2017 - 2021 Tammo Ippen, tammo.ippen@posteo.de
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... | 34.652174 | 82 | 0.733375 | from __future__ import absolute_import, division, print_function, unicode_literals
from random import random
from time import time
import plotille
def main():
y = []
for _ in range(1000):
y.append(random())
x = list(range(1000))
t0 = time()
for _ in range(100):
plotille.plo... | true | true |
1c3a887dabb03f7c39d9c6c34de15cc8e62da156 | 1,254 | py | Python | sub_price/check_sub_price.py | nengchibawanfan/PriceServer | b8ea95fa60ca5b940417f56c45a757c661d83e27 | [
"Apache-2.0"
] | null | null | null | sub_price/check_sub_price.py | nengchibawanfan/PriceServer | b8ea95fa60ca5b940417f56c45a757c661d83e27 | [
"Apache-2.0"
] | null | null | null | sub_price/check_sub_price.py | nengchibawanfan/PriceServer | b8ea95fa60ca5b940417f56c45a757c661d83e27 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Author: zhangchao
# Date: 2019-07-18
# Desc: 监控获取价格是否正常,不正常,就重启
import datetime
import sys
sys.path.append("..")
from priceserver.common.db_connection import ConnectRedis
import os
import time
r = ConnectRedis()
while True:
now = time.time()
bytetrade_data = float(r.get("Receive_th... | 24.115385 | 68 | 0.633174 | import datetime
import sys
sys.path.append("..")
from priceserver.common.db_connection import ConnectRedis
import os
import time
r = ConnectRedis()
while True:
now = time.time()
bytetrade_data = float(r.get("Receive_the_data_bytetrade1"))
huobi_data = float(r.get("Receive_the_data_huobi1"))
coinbase... | true | true |
1c3a88c75dc22fd6c086daa4e3caa2aea840cf10 | 143 | py | Python | painter/config_example.py | pwentrys/SubstanceHelpers | 8fb56158ee149792219e9cdb9479aaaed09a46bc | [
"MIT"
] | 2 | 2018-09-12T23:35:33.000Z | 2019-10-09T06:56:17.000Z | painter/config_example.py | pwentrys/SubstanceHelpers | 8fb56158ee149792219e9cdb9479aaaed09a46bc | [
"MIT"
] | null | null | null | painter/config_example.py | pwentrys/SubstanceHelpers | 8fb56158ee149792219e9cdb9479aaaed09a46bc | [
"MIT"
] | null | null | null | NAME = "Painter"
# Install path
PATH = 'C:\Program Files\Allegorithmic\Substance Painter 2'
# Shelf locs
SHELVES = [
'C:\PainterShelf'
]
| 14.3 | 59 | 0.685315 | NAME = "Painter"
PATH = 'C:\Program Files\Allegorithmic\Substance Painter 2'
SHELVES = [
'C:\PainterShelf'
]
| true | true |
1c3a8a24e9fc061f7eddf2ad3093701e875437f6 | 541 | py | Python | tests/functional/test_user.py | dimkonko/pyramid_api_example | b3bfb8dbe623544af9b147081d3e25c75a191c24 | [
"MIT"
] | null | null | null | tests/functional/test_user.py | dimkonko/pyramid_api_example | b3bfb8dbe623544af9b147081d3e25c75a191c24 | [
"MIT"
] | null | null | null | tests/functional/test_user.py | dimkonko/pyramid_api_example | b3bfb8dbe623544af9b147081d3e25c75a191c24 | [
"MIT"
] | null | null | null | from http import HTTPStatus
from tests import utils
from tests.functional import BaseFunctionalTest
from pyramid_api_example import routes
from pyramid_api_example.constants import json_keys
class UserFuncTest(BaseFunctionalTest):
def test_get_user(self):
expected_user_sid = 1
url = routes.USER... | 28.473684 | 78 | 0.770795 | from http import HTTPStatus
from tests import utils
from tests.functional import BaseFunctionalTest
from pyramid_api_example import routes
from pyramid_api_example.constants import json_keys
class UserFuncTest(BaseFunctionalTest):
def test_get_user(self):
expected_user_sid = 1
url = routes.USER... | true | true |
1c3a8afeb10498842e4277762aa6b8a972be7995 | 68,797 | py | Python | tests/test_build_latex.py | Paebbels/sphinx | 6a0215198fea5ec1dbda398aee8c64999baa0c0d | [
"BSD-2-Clause"
] | null | null | null | tests/test_build_latex.py | Paebbels/sphinx | 6a0215198fea5ec1dbda398aee8c64999baa0c0d | [
"BSD-2-Clause"
] | null | null | null | tests/test_build_latex.py | Paebbels/sphinx | 6a0215198fea5ec1dbda398aee8c64999baa0c0d | [
"BSD-2-Clause"
] | null | null | null | """
test_build_latex
~~~~~~~~~~~~~~~~
Test the build process with LaTeX builder with the test root.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import subprocess
from itertools import product
from shutil import c... | 42.731056 | 107 | 0.654592 |
import os
import re
import subprocess
from itertools import product
from shutil import copyfile
from subprocess import PIPE, CalledProcessError
import pytest
from sphinx.builders.latex import default_latex_documents
from sphinx.config import Config
from sphinx.errors import SphinxError
from sphinx.testing.util impor... | true | true |
1c3a8c414a28b8a4e64b1e5af1db385c22b871fa | 2,894 | py | Python | atari_environment.py | geek-guild/async-rl | b208b023541cae468ca4c9eceec590b9bfd71abd | [
"MIT"
] | null | null | null | atari_environment.py | geek-guild/async-rl | b208b023541cae468ca4c9eceec590b9bfd71abd | [
"MIT"
] | null | null | null | atari_environment.py | geek-guild/async-rl | b208b023541cae468ca4c9eceec590b9bfd71abd | [
"MIT"
] | null | null | null | import tensorflow as tf
from skimage.transform import resize
from skimage.color import rgb2gray
import numpy as np
from collections import deque
class AtariEnvironment(object):
"""
Small wrapper for gym atari environments.
Responsible for preprocessing screens and holding on to a screen buffer
of size... | 38.078947 | 103 | 0.660677 | import tensorflow as tf
from skimage.transform import resize
from skimage.color import rgb2gray
import numpy as np
from collections import deque
class AtariEnvironment(object):
def __init__(self, gym_env, resized_width, resized_height, agent_history_length):
self.env = gym_env
self.resized_width = ... | true | true |
1c3a8c56543c4ec65cc7575eab9aa5d09bc0d6f9 | 3,668 | py | Python | toontown/classicchars/DistributedMickey.py | LittleNed/toontown-stride | 1252a8f9a8816c1810106006d09c8bdfe6ad1e57 | [
"Apache-2.0"
] | 3 | 2020-01-02T08:43:36.000Z | 2020-07-05T08:59:02.000Z | toontown/classicchars/DistributedMickey.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | null | null | null | toontown/classicchars/DistributedMickey.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | 4 | 2019-06-20T23:45:23.000Z | 2020-10-14T20:30:15.000Z | from pandac.PandaModules import *
from toontown.classicchars import DistributedCCharBase
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from toontown.classicchars import CharStateDatas
from toontown.toonbase import ToontownGlobals
from toontown.t... | 36.68 | 270 | 0.681843 | from pandac.PandaModules import *
from toontown.classicchars import DistributedCCharBase
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from toontown.classicchars import CharStateDatas
from toontown.toonbase import ToontownGlobals
from toontown.t... | true | true |
1c3a8dfa2890051addf80f856407956287991ab1 | 3,121 | py | Python | forms/edit_customer_form.py | chucktilbury/Accounting | 15c467dac4405e872f3820e3ff35a53240335631 | [
"MIT"
] | null | null | null | forms/edit_customer_form.py | chucktilbury/Accounting | 15c467dac4405e872f3820e3ff35a53240335631 | [
"MIT"
] | null | null | null | forms/edit_customer_form.py | chucktilbury/Accounting | 15c467dac4405e872f3820e3ff35a53240335631 | [
"MIT"
] | null | null | null | from system.forms import Forms
from system.logger import *
#from dialogs.edit_dialogs import *
from dialogs.select_dialog import *
@class_wrapper
class _edit_customer_form(Forms):
def __init__(self, owner, row_index):
self.logger.set_level(Logger.DEBUG)
super().__init__(owner, 'Customer')
... | 31.525253 | 95 | 0.631849 | from system.forms import Forms
from system.logger import *
from dialogs.select_dialog import *
@class_wrapper
class _edit_customer_form(Forms):
def __init__(self, owner, row_index):
self.logger.set_level(Logger.DEBUG)
super().__init__(owner, 'Customer')
self.row_index = row_index
def... | true | true |
1c3a8e1b7776bb7c26532d73ed96fde7231f2dc6 | 1,122 | py | Python | contents/app_unittest.py | joeyster/Travel-Planner | 85e21b7277a50621ed8cf4b2aa5d1b80d3d47005 | [
"MIT"
] | null | null | null | contents/app_unittest.py | joeyster/Travel-Planner | 85e21b7277a50621ed8cf4b2aa5d1b80d3d47005 | [
"MIT"
] | null | null | null | contents/app_unittest.py | joeyster/Travel-Planner | 85e21b7277a50621ed8cf4b2aa5d1b80d3d47005 | [
"MIT"
] | null | null | null | import unittest
import app
# Note: the class must be called Test
class Test(unittest.TestCase):
def test_if_it_runs_to_the_end(self):
#self.assertEqual(app.testing_address(["California", "Nevada", "Illinois", "New York", "Maine"],["Nevada", "Illinois", "New York", "Maine"]), True)
#self.assertEqual(app.testi... | 70.125 | 192 | 0.66934 | import unittest
import app
class Test(unittest.TestCase):
def test_if_it_runs_to_the_end(self):
self.assertEqual(app.testing_address(["California", "Montana", "Wyoming", "Idaho", "Texas", "Florida", "Maine"], ["Montana", "Wyoming", "Idaho", "Texas", "Florida", "Maine"]), True)
if __name__ ==... | true | true |
1c3a8e554480fc8f2650a603e40fee871e2120be | 29,684 | py | Python | programs/tfFromJson.py | Nino-cunei/ninmed | 30f3c096201184c71279eebd572c4fcae0f3dcea | [
"MIT"
] | null | null | null | programs/tfFromJson.py | Nino-cunei/ninmed | 30f3c096201184c71279eebd572c4fcae0f3dcea | [
"MIT"
] | null | null | null | programs/tfFromJson.py | Nino-cunei/ninmed | 30f3c096201184c71279eebd572c4fcae0f3dcea | [
"MIT"
] | null | null | null | import sys
import os
import re
import json
import yaml
from shutil import rmtree
from tf.fabric import Fabric
from tf.convert.walker import CV
HELP = """
python3 tfFromJson.py
Generate TF and if successful, load it
python3 tfFromJson.py -Pnumber
python3 tfFromJson.py -Pnumber:obverse
python3 tfFromJson.py -Pnumbe... | 33.390326 | 122 | 0.467356 | import sys
import os
import re
import json
import yaml
from shutil import rmtree
from tf.fabric import Fabric
from tf.convert.walker import CV
HELP = """
python3 tfFromJson.py
Generate TF and if successful, load it
python3 tfFromJson.py -Pnumber
python3 tfFromJson.py -Pnumber:obverse
python3 tfFromJson.py -Pnumbe... | true | true |
1c3a8ef5fc397e1e41b51b5816497d1dcb8e05b6 | 114,734 | py | Python | theano/gpuarray/opt.py | JimmyRetza/Theano | 72d83bce0d547d54ab3513bcba35c166979f7a6f | [
"BSD-3-Clause"
] | 1 | 2020-05-01T11:09:48.000Z | 2020-05-01T11:09:48.000Z | theano/gpuarray/opt.py | JimmyRetza/Theano | 72d83bce0d547d54ab3513bcba35c166979f7a6f | [
"BSD-3-Clause"
] | null | null | null | theano/gpuarray/opt.py | JimmyRetza/Theano | 72d83bce0d547d54ab3513bcba35c166979f7a6f | [
"BSD-3-Clause"
] | 1 | 2018-04-06T08:31:11.000Z | 2018-04-06T08:31:11.000Z | from __future__ import absolute_import, print_function, division
import copy
import numpy as np
import logging
import pdb
import time
from six import iteritems
from six.moves import xrange
import sys
import theano
from theano import tensor, scalar, gof, config
from theano.compile import optdb
from theano.compile.ops i... | 39.078338 | 118 | 0.613088 | from __future__ import absolute_import, print_function, division
import copy
import numpy as np
import logging
import pdb
import time
from six import iteritems
from six.moves import xrange
import sys
import theano
from theano import tensor, scalar, gof, config
from theano.compile import optdb
from theano.compile.ops i... | true | true |
1c3a8f24f03cf22ef585b3ddd3df1a97ed17f540 | 3,407 | py | Python | src/experiment3.py | jbrowarczyk/jb-masters-thesis | c345f43b32126d16f10c3706f5f798fde0665ee0 | [
"MIT"
] | null | null | null | src/experiment3.py | jbrowarczyk/jb-masters-thesis | c345f43b32126d16f10c3706f5f798fde0665ee0 | [
"MIT"
] | null | null | null | src/experiment3.py | jbrowarczyk/jb-masters-thesis | c345f43b32126d16f10c3706f5f798fde0665ee0 | [
"MIT"
] | null | null | null | from sklearn.svm import SVC
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
from global_settings import TRAIN_VERBOSE
from utils import make_train_data, make_test_data, save_txt
import numpy as np
import joblib
import os
EXPERIMENT_NAME = "experiment3"
FEATURES = ["ar_16","ar_24",... | 36.244681 | 124 | 0.681538 | from sklearn.svm import SVC
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
from global_settings import TRAIN_VERBOSE
from utils import make_train_data, make_test_data, save_txt
import numpy as np
import joblib
import os
EXPERIMENT_NAME = "experiment3"
FEATURES = ["ar_16","ar_24",... | true | true |
1c3a9025eae1873418a0515dcc1c81865dc85b2e | 1,054 | py | Python | hot_encoding/hot_encoding.py | JOHNKYON/Kaggle_Learn | 6a45931e4ec1e189b95c61e27e90499347840180 | [
"MIT"
] | null | null | null | hot_encoding/hot_encoding.py | JOHNKYON/Kaggle_Learn | 6a45931e4ec1e189b95c61e27e90499347840180 | [
"MIT"
] | null | null | null | hot_encoding/hot_encoding.py | JOHNKYON/Kaggle_Learn | 6a45931e4ec1e189b95c61e27e90499347840180 | [
"MIT"
] | null | null | null | """Python script for kaggle house price predict practice"""
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import Imputer
import pandas as pd
def main():
"""Main script"""
# Load data
train_data = pd.read_csv('data/train.csv')
test_data = pd.read_csv('data/test.csv')
... | 25.707317 | 70 | 0.689753 |
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import Imputer
import pandas as pd
def main():
train_data = pd.read_csv('data/train.csv')
test_data = pd.read_csv('data/test.csv')
y_train = train_data.SalePrice
x_train = train_data.drop(['SalePrice'], axis=1)
x_t... | true | true |
1c3a91564e3c7ad9a2f962c279bae9bd74910638 | 36,430 | py | Python | tests/staticfiles_tests/tests.py | dsanders11/django-future-staticfiles | 47aef8cdcfc76d2099884fb0ed77e39e3974f78b | [
"BSD-3-Clause"
] | null | null | null | tests/staticfiles_tests/tests.py | dsanders11/django-future-staticfiles | 47aef8cdcfc76d2099884fb0ed77e39e3974f78b | [
"BSD-3-Clause"
] | null | null | null | tests/staticfiles_tests/tests.py | dsanders11/django-future-staticfiles | 47aef8cdcfc76d2099884fb0ed77e39e3974f78b | [
"BSD-3-Clause"
] | null | null | null | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import os
import posixpath
import shutil
import sys
import tempfile
import unittest
import django
from django.conf import settings
from django.contrib.staticfiles import finders, storage
from django.contrib.staticfiles.management.commands... | 39.989023 | 372 | 0.668542 | from __future__ import unicode_literals
import codecs
import os
import posixpath
import shutil
import sys
import tempfile
import unittest
import django
from django.conf import settings
from django.contrib.staticfiles import finders, storage
from django.contrib.staticfiles.management.commands import collectstatic
from... | true | true |
1c3a9281d90a51a0564b84bda147ed62f5c13d92 | 1,794 | py | Python | haiku_generation/src/models/embedding.py | nivethakesavan2203/haiku-generation | ef66c0aa5a5ffcfcfa26b8e993d3efdfcc1be804 | [
"MIT"
] | null | null | null | haiku_generation/src/models/embedding.py | nivethakesavan2203/haiku-generation | ef66c0aa5a5ffcfcfa26b8e993d3efdfcc1be804 | [
"MIT"
] | 3 | 2020-10-24T18:32:37.000Z | 2020-11-28T23:36:28.000Z | haiku_generation/src/models/embedding.py | nivethakesavan2203/haiku-generation | ef66c0aa5a5ffcfcfa26b8e993d3efdfcc1be804 | [
"MIT"
] | null | null | null | import torch
'''
one method:
load RoBERTa from torch.hub
import torch
roberta_torch = torch.hub.load('pytorch/fairseq', 'roberta.large')
roberta_torch.eval()
sentence = "I Love RoBERTa!!! I Love Pytorch!!!"
Apply Byte-Pair Encoding to input text, tokens should be a tensor
tokens_torch = roberta_torch.encode(sentence... | 29.9 | 151 | 0.741918 | import torch
class RobertaModel():
def __init__(self):
self.model = torch.hub.load('pytorch/fairseq', 'roberta.large')
self.model.eval().cuda()
def __call__(self, content):
tokens = self.model.encode(content)
embed = self.model.extract_features(tokens, return_all_hiddens=Tru... | true | true |
1c3a929aa2844f2ac2e11633089511aa74cb0049 | 4,486 | py | Python | tools/automation/tests/run.py | KTH/azure-cli | 58aa9e320ea7c5213b4517172eaf71b3f5230fd6 | [
"MIT"
] | null | null | null | tools/automation/tests/run.py | KTH/azure-cli | 58aa9e320ea7c5213b4517172eaf71b3f5230fd6 | [
"MIT"
] | null | null | null | tools/automation/tests/run.py | KTH/azure-cli | 58aa9e320ea7c5213b4517172eaf71b3f5230fd6 | [
"MIT"
] | 1 | 2017-12-28T04:51:44.000Z | 2017-12-28T04:51:44.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 43.980392 | 119 | 0.626839 |
import argparse
import os
import sys
from automation.utilities.path import filter_user_selected_modules_with_tests, get_repo_root
from automation.tests.nose_helper import get_nose_runner
from automation.utilities.path import get_test_results_dir
def get_unittest_runner(tests):
test_cases = list(tests)
def ... | true | true |
1c3a92d72255f09c347645c69476c6e68af4c9c1 | 19,357 | py | Python | galpy/potential/DiskSCFPotential.py | gusbeane/galpy | d6db971285f163456c81775fc2fdc7d75189762c | [
"BSD-3-Clause"
] | null | null | null | galpy/potential/DiskSCFPotential.py | gusbeane/galpy | d6db971285f163456c81775fc2fdc7d75189762c | [
"BSD-3-Clause"
] | null | null | null | galpy/potential/DiskSCFPotential.py | gusbeane/galpy | d6db971285f163456c81775fc2fdc7d75189762c | [
"BSD-3-Clause"
] | null | null | null | ###############################################################################
# DiskSCFPotential.py: Potential expansion for disk+halo potentials
###############################################################################
from pkg_resources import parse_version
import copy
import numpy
import scipy
_SCIPY_VERSI... | 40.495816 | 799 | 0.536498 | from pkg_resources import parse_version
import copy
import numpy
import scipy
_SCIPY_VERSION= parse_version(scipy.__version__)
if _SCIPY_VERSION < parse_version('0.10'): from scipy.maxentropy import logsumexp
elif _SCIPY_VERSION < parse_version('0.19'): from scipy.misc import logsumexp
else:
from scipy.spec... | true | true |
1c3a93f1cd72a0f6b6fbfcf2ca8188fce01f5828 | 834 | py | Python | src/Tikzifyables/Decorationable.py | Lovely-XPP/tkzgeom | bf68e139dc05f759542d6611f4dc07f4f2727b92 | [
"MIT"
] | 41 | 2021-11-24T05:54:08.000Z | 2022-03-26T10:19:30.000Z | src/Tikzifyables/Decorationable.py | Lovely-XPP/tkzgeom | bf68e139dc05f759542d6611f4dc07f4f2727b92 | [
"MIT"
] | 1 | 2022-02-28T04:34:51.000Z | 2022-03-07T10:49:27.000Z | src/Tikzifyables/Decorationable.py | Lovely-XPP/tkzgeom | bf68e139dc05f759542d6611f4dc07f4f2727b92 | [
"MIT"
] | 10 | 2021-11-24T07:35:17.000Z | 2022-03-25T18:42:14.000Z | import Constant as c
class Decorationable:
def __init__(self, item):
"""Construct Decorationable."""
self.item = item
def tikzify_decoration(self):
"""Turn curve decoration into tikz code."""
if self.item["line"]["decoration"]["type"] == c.DecorationType.NONE:
retur... | 41.7 | 90 | 0.583933 | import Constant as c
class Decorationable:
def __init__(self, item):
self.item = item
def tikzify_decoration(self):
if self.item["line"]["decoration"]["type"] == c.DecorationType.NONE:
return ''
if self.item["line"]["decoration"]["type"] == c.DecorationType.TEXT_ALONG_CURVE... | true | true |
1c3a9741c2cbff4bf9b26ce9cbf7b6d02d6e6f9d | 2,667 | py | Python | run_tests.py | Luvideria/lightmetrica-v3 | 3e83db59998e79648047bac29c37d8eb18d7600d | [
"MIT"
] | 101 | 2019-05-31T21:27:58.000Z | 2022-02-03T18:54:16.000Z | run_tests.py | Luvideria/lightmetrica-v3 | 3e83db59998e79648047bac29c37d8eb18d7600d | [
"MIT"
] | 11 | 2019-09-19T16:03:09.000Z | 2020-12-05T18:37:54.000Z | run_tests.py | Luvideria/lightmetrica-v3 | 3e83db59998e79648047bac29c37d8eb18d7600d | [
"MIT"
] | 14 | 2019-06-05T03:06:09.000Z | 2022-01-15T06:36:24.000Z | """Helper script to run all unit tests"""
import os
import sys
import json
import argparse
import subprocess as sp
from colorama import Fore, Back, Style
import pytest
from functest.run_all import run_functests
def add_bool_arg(parser, name, default):
"""Add boolean option with mutually exclusive group"""
# cf... | 41.030769 | 136 | 0.615298 | import os
import sys
import json
import argparse
import subprocess as sp
from colorama import Fore, Back, Style
import pytest
from functest.run_all import run_functests
def add_bool_arg(parser, name, default):
dest = name.replace('-','_')
group = parser.add_mutually_exclusive_group(required=False)
grou... | true | true |
1c3a974367ccfcc39831aa874107cd41653b60c8 | 476 | py | Python | tests/comment_tests/custom_comments/views.py | webjunkie/django | 5dbca13f3baa2e1bafd77e84a80ad6d8a074712e | [
"BSD-3-Clause"
] | 790 | 2015-01-03T02:13:39.000Z | 2020-05-10T19:53:57.000Z | AppServer/lib/django-1.5/tests/regressiontests/comment_tests/custom_comments/views.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 1,361 | 2015-01-08T23:09:40.000Z | 2020-04-14T00:03:04.000Z | AppServer/lib/django-1.5/tests/regressiontests/comment_tests/custom_comments/views.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 155 | 2015-01-08T22:59:31.000Z | 2020-04-08T08:01:53.000Z | from django.http import HttpResponse
def custom_submit_comment(request):
return HttpResponse("Hello from the custom submit comment view.")
def custom_flag_comment(request, comment_id):
return HttpResponse("Hello from the custom flag view.")
def custom_delete_comment(request, comment_id):
return HttpResp... | 31.733333 | 69 | 0.787815 | from django.http import HttpResponse
def custom_submit_comment(request):
return HttpResponse("Hello from the custom submit comment view.")
def custom_flag_comment(request, comment_id):
return HttpResponse("Hello from the custom flag view.")
def custom_delete_comment(request, comment_id):
return HttpResp... | true | true |
1c3a978c83cd8797ced0ce6a31280f63002b394e | 876 | py | Python | tracing/tracing/mre/job.py | ravitejavalluri/catapult | 246a39a82c2213d913a96fff020a263838dc76e6 | [
"BSD-3-Clause"
] | null | null | null | tracing/tracing/mre/job.py | ravitejavalluri/catapult | 246a39a82c2213d913a96fff020a263838dc76e6 | [
"BSD-3-Clause"
] | 1 | 2021-02-23T22:20:14.000Z | 2021-02-23T22:20:14.000Z | tracing/tracing/mre/job.py | ravitejavalluri/catapult | 246a39a82c2213d913a96fff020a263838dc76e6 | [
"BSD-3-Clause"
] | 1 | 2020-12-12T10:38:37.000Z | 2020-12-12T10:38:37.000Z | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import uuid
from tracing.mre import function_handle
class Job(object):
def __init__(self, map_function_handle, guid=uuid.uuid4()):
assert map_functi... | 23.675676 | 72 | 0.718037 | import uuid
from tracing.mre import function_handle
class Job(object):
def __init__(self, map_function_handle, guid=uuid.uuid4()):
assert map_function_handle is not None
self._map_function_handle = map_function_handle
self._guid = guid
@property
def guid(self):
return self._guid
@property... | true | true |
1c3a99e3183356804b19506bb3a1a514d934c5ba | 77 | py | Python | geco/mips/packing/__init__.py | FreestyleBuild/GeCO | 6db1a549b3145b3bc5d3025a9bccc03be6575564 | [
"MIT"
] | 8 | 2020-12-16T09:59:05.000Z | 2022-03-18T09:48:43.000Z | geco/mips/packing/__init__.py | FreestyleBuild/GeCO | 6db1a549b3145b3bc5d3025a9bccc03be6575564 | [
"MIT"
] | 101 | 2020-11-09T10:20:03.000Z | 2022-03-24T13:50:06.000Z | geco/mips/packing/__init__.py | FreestyleBuild/GeCO | 6db1a549b3145b3bc5d3025a9bccc03be6575564 | [
"MIT"
] | 3 | 2021-04-06T13:26:03.000Z | 2022-03-22T13:22:16.000Z | from geco.mips.packing.generic import *
from geco.mips.packing.tang import *
| 25.666667 | 39 | 0.792208 | from geco.mips.packing.generic import *
from geco.mips.packing.tang import *
| true | true |
1c3a9b110a5850286ee33cd2b54e8186479fc867 | 1,029 | py | Python | src/utils/misc.py | iN1k1/deep-pyramidal-representations-peron-re-identification | 18eacd3b7bde2c4767ba290b655cb0f5c72ed8fe | [
"MIT"
] | 13 | 2019-08-09T08:33:27.000Z | 2020-12-21T08:51:33.000Z | src/utils/misc.py | iN1k1/deep-pyramidal-representations-peron-re-identification | 18eacd3b7bde2c4767ba290b655cb0f5c72ed8fe | [
"MIT"
] | 5 | 2021-03-19T02:17:23.000Z | 2022-03-11T23:53:44.000Z | src/utils/misc.py | iN1k1/deep-pyramidal-representations-peron-re-identification | 18eacd3b7bde2c4767ba290b655cb0f5c72ed8fe | [
"MIT"
] | 4 | 2019-11-06T08:02:21.000Z | 2021-01-13T20:34:23.000Z | import copy
import pickle
def create_list_of_dictionaries(num_items):
return [{} for _ in range(num_items)]
def clone(obj):
return copy.deepcopy(obj)
def save(file_name, **kwargs):
with open(file_name, 'wb') as fp:
pickle.dump(len(kwargs)+1, fp)
keys = list(kwargs.keys())
pickl... | 24.5 | 64 | 0.589893 | import copy
import pickle
def create_list_of_dictionaries(num_items):
return [{} for _ in range(num_items)]
def clone(obj):
return copy.deepcopy(obj)
def save(file_name, **kwargs):
with open(file_name, 'wb') as fp:
pickle.dump(len(kwargs)+1, fp)
keys = list(kwargs.keys())
pickl... | true | true |
1c3a9c1696c04d95ff2bc346a005dbf72e3c517c | 8,992 | py | Python | examples/seq2seq/utils.py | anonSub2/bem | 2791575213ce2d64381ee3f5dd2e5428be23b960 | [
"MIT"
] | 2 | 2021-02-14T10:27:31.000Z | 2022-01-03T06:53:49.000Z | examples/seq2seq/utils.py | anonSub2/bem | 2791575213ce2d64381ee3f5dd2e5428be23b960 | [
"MIT"
] | 9 | 2020-11-13T17:51:46.000Z | 2022-03-12T00:46:15.000Z | examples/seq2seq/utils.py | anonSub2/bem | 2791575213ce2d64381ee3f5dd2e5428be23b960 | [
"MIT"
] | 1 | 2021-02-12T16:31:47.000Z | 2021-02-12T16:31:47.000Z | import itertools
import json
import os
import pickle
from pathlib import Path
from typing import Callable, Dict, Iterable, List
import git
import numpy as np
import torch
from rouge_score import rouge_scorer, scoring
from sacrebleu import corpus_bleu
from torch import nn
from torch.utils.data import Dataset, Sampler
f... | 33.058824 | 119 | 0.663479 | import itertools
import json
import os
import pickle
from pathlib import Path
from typing import Callable, Dict, Iterable, List
import git
import numpy as np
import torch
from rouge_score import rouge_scorer, scoring
from sacrebleu import corpus_bleu
from torch import nn
from torch.utils.data import Dataset, Sampler
f... | true | true |
1c3a9cc108eeeaa60a56ed7406883c6368b6ea5c | 7,821 | py | Python | sdks/python/http_client/v1/polyaxon_sdk/models/v1_run_artifact.py | gregmbi/polyaxon | 8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/polyaxon_sdk/models/v1_run_artifact.py | gregmbi/polyaxon | 8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/polyaxon_sdk/models/v1_run_artifact.py | gregmbi/polyaxon | 8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 25.558824 | 85 | 0.567319 |
import pprint
import re
import six
from polyaxon_sdk.configuration import Configuration
class V1RunArtifact(object):
openapi_types = {
"name": "str",
"state": "str",
"kind": "V1ArtifactKind",
"path": "str",
"connection": "str",
"summary": "object",
"... | true | true |
1c3a9cd61084c77c0da42925d3d0f03f40572a9e | 6,298 | py | Python | dojango/data/__init__.py | google-code-export/dojango | d350a0042635fcdb1a57b413a9836a728bc13d48 | [
"BSD-3-Clause"
] | 12 | 2015-06-07T23:14:36.000Z | 2018-05-14T11:03:41.000Z | dojango/data/__init__.py | thedrow/dojango | 9a6193153598ca22a088031c903930c8944f612b | [
"BSD-3-Clause"
] | 2 | 2015-04-03T09:16:37.000Z | 2015-11-01T01:39:49.000Z | dojango/data/__init__.py | thedrow/dojango | 9a6193153598ca22a088031c903930c8944f612b | [
"BSD-3-Clause"
] | 4 | 2017-02-19T03:15:45.000Z | 2019-12-27T15:01:50.000Z | import re
__all__ = ('QueryInfo', 'QueryReadStoreInfo',
'JsonRestStoreInfo', 'JsonQueryRestStoreInfo',)
class QueryInfoFeatures(object):
sorting = True
paging = False
class QueryInfo(object):
'''Usage (is that the right solution?):
info = QueryInfo(request)
info.extract()
... | 34.604396 | 103 | 0.544141 | import re
__all__ = ('QueryInfo', 'QueryReadStoreInfo',
'JsonRestStoreInfo', 'JsonQueryRestStoreInfo',)
class QueryInfoFeatures(object):
sorting = True
paging = False
class QueryInfo(object):
start = 0
end = 25
filters = {}
sorting = []
request = None
max_count = 25
... | true | true |
1c3a9d06ab53caee2453bd894a5e26b2ee1e502f | 16,846 | py | Python | Improving Deep Neural Networks Hyperparameter tuning, Regularization and Optimization/Initialization.py | ghbtest/deep-learning-coursera | 95d343f2136e20f285963a2605739dc966d82b09 | [
"MIT"
] | null | null | null | Improving Deep Neural Networks Hyperparameter tuning, Regularization and Optimization/Initialization.py | ghbtest/deep-learning-coursera | 95d343f2136e20f285963a2605739dc966d82b09 | [
"MIT"
] | null | null | null | Improving Deep Neural Networks Hyperparameter tuning, Regularization and Optimization/Initialization.py | ghbtest/deep-learning-coursera | 95d343f2136e20f285963a2605739dc966d82b09 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # Initialization
#
# Welcome to the first assignment of "Improving Deep Neural Networks".
#
# Training your neural network requires specifying an initial value of the weights. A well chosen initialization method will help learning.
#
# If you completed the previous course ... | 33.692 | 426 | 0.649056 |
import numpy as np
import matplotlib.pyplot as plt
import sklearn
import sklearn.datasets
from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation
from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec
get_ipython().run_line_magic('... | true | true |
1c3a9d8f7b6e6385b2b168615513a966bcde5285 | 3,042 | py | Python | basmati/basmati_cmd.py | markmuetz/basmati | cb6fc0e1959501f7ea136c5184f897557459bc54 | [
"Apache-2.0"
] | 4 | 2020-02-21T02:42:37.000Z | 2021-09-08T17:10:38.000Z | basmati/basmati_cmd.py | markmuetz/basmati | cb6fc0e1959501f7ea136c5184f897557459bc54 | [
"Apache-2.0"
] | null | null | null | basmati/basmati_cmd.py | markmuetz/basmati | cb6fc0e1959501f7ea136c5184f897557459bc54 | [
"Apache-2.0"
] | 1 | 2021-09-08T09:15:32.000Z | 2021-09-08T09:15:32.000Z | import argparse
import sys
from typing import List
from basmati.basmati_demo import demo_main
from basmati.basmati_errors import BasmatiError
from basmati.downloader import download_main, DATASETS, HYDROBASINS_REGIONS
from basmati.setup_logging import setup_logger
from basmati.version import get_version
def _build_p... | 37.097561 | 93 | 0.624918 | import argparse
import sys
from typing import List
from basmati.basmati_demo import demo_main
from basmati.basmati_errors import BasmatiError
from basmati.downloader import download_main, DATASETS, HYDROBASINS_REGIONS
from basmati.setup_logging import setup_logger
from basmati.version import get_version
def _build_p... | true | true |
1c3a9dd8d891bfd4b9d4f475db13dadf84fa110b | 1,243 | py | Python | allennlp/modules/seq2vec_encoders/seq2vec_encoder.py | nadgeri14/allennlp | 2eefffaf71612263a1c20e8ce4107849cfd5efe3 | [
"Apache-2.0"
] | null | null | null | allennlp/modules/seq2vec_encoders/seq2vec_encoder.py | nadgeri14/allennlp | 2eefffaf71612263a1c20e8ce4107849cfd5efe3 | [
"Apache-2.0"
] | null | null | null | allennlp/modules/seq2vec_encoders/seq2vec_encoder.py | nadgeri14/allennlp | 2eefffaf71612263a1c20e8ce4107849cfd5efe3 | [
"Apache-2.0"
] | null | null | null | from allennlp.modules.encoder_base import _EncoderBase
from allennlp.common import Registrable
class Seq2VecEncoder(_EncoderBase, Registrable):
"""
A ``Seq2VecEncoder`` is a ``Module`` that takes as input a sequence of vectors and returns a
single vector. Input shape : ``(batch_size, sequence_length, inp... | 41.433333 | 105 | 0.680611 | from allennlp.modules.encoder_base import _EncoderBase
from allennlp.common import Registrable
class Seq2VecEncoder(_EncoderBase, Registrable):
def get_input_dim(self) -> int:
raise NotImplementedError
def get_output_dim(self) -> int:
raise NotImplementedError
| true | true |
1c3a9e2d07809822b70de13a2212e36d403b00b3 | 149 | py | Python | Muta3DMaps/core/AsyncV/__init__.py | NatureGeorge/SIFTS_Plus_Muta_Maps | 60f84e6024508e65ee3791103762b95666d3c646 | [
"MIT"
] | null | null | null | Muta3DMaps/core/AsyncV/__init__.py | NatureGeorge/SIFTS_Plus_Muta_Maps | 60f84e6024508e65ee3791103762b95666d3c646 | [
"MIT"
] | null | null | null | Muta3DMaps/core/AsyncV/__init__.py | NatureGeorge/SIFTS_Plus_Muta_Maps | 60f84e6024508e65ee3791103762b95666d3c646 | [
"MIT"
] | null | null | null | # @Date: 2019-11-20T22:46:50+08:00
# @Email: 1730416009@stu.suda.edu.cn
# @Filename: __init__.py
# @Last modified time: 2019-11-24T23:13:42+08:00
| 29.8 | 48 | 0.691275 | true | true | |
1c3a9e8a268974d656e0c50418552adb90db0085 | 1,799 | py | Python | test/functional/sapling_malleable_sigs.py | ISLAMIC-DIGITAL-COIN/IDC | f78f9f0aa065698b4f826ed7765e9591e7ca855d | [
"MIT"
] | 1 | 2021-12-30T23:56:46.000Z | 2021-12-30T23:56:46.000Z | test/functional/sapling_malleable_sigs.py | martin-braun/IDC | 96af3558b4e2ae127082856ac9ed134d04878e69 | [
"MIT"
] | null | null | null | test/functional/sapling_malleable_sigs.py | martin-braun/IDC | 96af3558b4e2ae127082856ac9ed134d04878e69 | [
"MIT"
] | 1 | 2022-01-10T22:15:21.000Z | 2022-01-10T22:15:21.000Z | #!/usr/bin/env python3
# Copyright (c) 2018 The Zcash developers
# Copyright (c) 2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
from test_framework.test_framework import islamic_digital_coinTestFramewor... | 31.561404 | 75 | 0.683157 |
from test_framework.test_framework import islamic_digital_coinTestFramework
from test_framework.messages import (
CTransaction,
)
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
bytes_to_hex_str,
hex_str_to_bytes,
)
from decimal import Decimal
from io import BytesIO
clas... | true | true |
1c3a9e997419f1c66cb061c2fa8a7c938ae57ecc | 1,929 | py | Python | panel/models/tabulator.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | 1 | 2021-03-09T04:46:05.000Z | 2021-03-09T04:46:05.000Z | panel/models/tabulator.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | 2 | 2022-01-13T03:54:51.000Z | 2022-03-12T01:01:00.000Z | panel/models/tabulator.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | null | null | null | """
Implementation of the Tabulator model.
See http://tabulator.info/
"""
from bokeh.core.properties import (
Any, Bool, Dict, Enum, Instance, Int, List, Nullable, String
)
from bokeh.models import ColumnDataSource
from bokeh.models.layouts import HTMLBox
from bokeh.models.widgets.tables import TableColumn
JS_SR... | 23.240964 | 119 | 0.658891 | from bokeh.core.properties import (
Any, Bool, Dict, Enum, Instance, Int, List, Nullable, String
)
from bokeh.models import ColumnDataSource
from bokeh.models.layouts import HTMLBox
from bokeh.models.widgets.tables import TableColumn
JS_SRC = "https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.js"
MOMENT_... | true | true |
1c3a9f36db55aa34814abb37e951ccba7dc54305 | 11,362 | py | Python | neutron/tests/common/l3_test_common.py | glove747/liberty-neutron | 35a4c85e781d10da4521565c3a367e4ecb50739d | [
"Apache-2.0"
] | null | null | null | neutron/tests/common/l3_test_common.py | glove747/liberty-neutron | 35a4c85e781d10da4521565c3a367e4ecb50739d | [
"Apache-2.0"
] | null | null | null | neutron/tests/common/l3_test_common.py | glove747/liberty-neutron | 35a4c85e781d10da4521565c3a367e4ecb50739d | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2015 Openstack Foundation
#
# 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 ... | 37.622517 | 78 | 0.539606 |
import copy
import netaddr
from oslo_utils import uuidutils
from six import moves
from neutron.common import constants as l3_constants
_uuid = uuidutils.generate_uuid
class FakeDev(object):
def __init__(self, name):
self.name = name
def get_ha_interface(ip='169.254.192.1', mac='12:34:56:78:2b:5d'):
... | true | true |
1c3aa08c26ba618b852d49dd757979604b6e5f00 | 135 | py | Python | fed_distill/resnet/__init__.py | Ahmedjjj/dataset-distillation | f2e4267d070c7fb8e50476297e95638f351b76d6 | [
"MIT"
] | null | null | null | fed_distill/resnet/__init__.py | Ahmedjjj/dataset-distillation | f2e4267d070c7fb8e50476297e95638f351b76d6 | [
"MIT"
] | null | null | null | fed_distill/resnet/__init__.py | Ahmedjjj/dataset-distillation | f2e4267d070c7fb8e50476297e95638f351b76d6 | [
"MIT"
] | null | null | null | from fed_distill.resnet.deep_inv import get_resnet_cifar_adi, get_resnet_cifar_di
from fed_distill.resnet.resnet_cifar import ResNet18
| 45 | 81 | 0.896296 | from fed_distill.resnet.deep_inv import get_resnet_cifar_adi, get_resnet_cifar_di
from fed_distill.resnet.resnet_cifar import ResNet18
| true | true |
1c3aa1c173c1c552d607933ad7f23096267b65be | 939 | py | Python | 1101-1200/1152-Erect the Fence/1152-Erect the Fence.py | jiadaizhao/LintCode | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 77 | 2017-12-30T13:33:37.000Z | 2022-01-16T23:47:08.000Z | 1101-1200/1152-Erect the Fence/1152-Erect the Fence.py | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 1 | 2018-05-14T14:15:40.000Z | 2018-05-14T14:15:40.000Z | 1101-1200/1152-Erect the Fence/1152-Erect the Fence.py | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 39 | 2017-12-07T14:36:25.000Z | 2022-03-10T23:05:37.000Z | """
Definition for a point.
class Point:
def __init__(self, a=0, b=0):
self.x = a
self.y = b
"""
class Solution:
"""
@param points: List[point]
@return: return List[point]
"""
def outerTrees(self, points):
# write your code here
def orientation(p, q, r):
... | 28.454545 | 80 | 0.479233 |
class Solution:
def outerTrees(self, points):
def orientation(p, q, r):
return (q.x - p.x) * (r.y - q.y) - (q.y - p.y) * (r.x - q.x)
points.sort(key=lambda p: (p.x, p.y))
hull = []
for point in points:
while len(hull) >= 2 and orientation(hul... | true | true |
1c3aa23cdce53bafdf329c20bc2930e04167cc41 | 3,034 | py | Python | nova/tests/unit/virt/libvirt/volume/test_scaleio.py | lixiaoy1/nova | 357b8b38e88300948bb2e07d1bbaabd1e9d7b60e | [
"Apache-2.0"
] | 1 | 2018-12-28T06:47:39.000Z | 2018-12-28T06:47:39.000Z | nova/tests/unit/virt/libvirt/volume/test_scaleio.py | lixiaoy1/nova | 357b8b38e88300948bb2e07d1bbaabd1e9d7b60e | [
"Apache-2.0"
] | null | null | null | nova/tests/unit/virt/libvirt/volume/test_scaleio.py | lixiaoy1/nova | 357b8b38e88300948bb2e07d1bbaabd1e9d7b60e | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2015 EMC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 40.453333 | 78 | 0.664799 |
import mock
from os_brick.initiator import connector
from nova.tests.unit.virt.libvirt.volume import test_volume
from nova.virt.libvirt.volume import scaleio
class LibvirtScaleIOVolumeDriverTestCase(
test_volume.LibvirtVolumeBaseTestCase):
def test_libvirt_scaleio_driver(self):
libvirt_driver ... | true | true |
1c3aa2b66d2aadf5d9b79addb89a1d275b4cfe78 | 1,036 | py | Python | pgroonga/migrations/0003_v2_api_upgrade.py | pranayshahxyz/zulip | 3da483487af79fde9dce2d21124dfa39b94936a5 | [
"Apache-2.0"
] | 1 | 2020-03-19T00:52:48.000Z | 2020-03-19T00:52:48.000Z | pgroonga/migrations/0003_v2_api_upgrade.py | pranayshahxyz/zulip | 3da483487af79fde9dce2d21124dfa39b94936a5 | [
"Apache-2.0"
] | null | null | null | pgroonga/migrations/0003_v2_api_upgrade.py | pranayshahxyz/zulip | 3da483487af79fde9dce2d21124dfa39b94936a5 | [
"Apache-2.0"
] | 1 | 2020-07-06T11:43:28.000Z | 2020-07-06T11:43:28.000Z | from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
atomic = False
dependencies = [
('pgroonga', '0002_html_escape_subject'),
]
database_setting = settings.DATABASES["default"]
operations = [
migrations.RunSQL(["""
ALTER ROLE %... | 28 | 77 | 0.733591 | from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
atomic = False
dependencies = [
('pgroonga', '0002_html_escape_subject'),
]
database_setting = settings.DATABASES["default"]
operations = [
migrations.RunSQL(["""
ALTER ROLE %... | true | true |
1c3aa448b5cb1afcb70e5b7f5dc5aa3936e5f3a4 | 973 | py | Python | String/415. Add Strings.py | beckswu/Leetcode | 480e8dc276b1f65961166d66efa5497d7ff0bdfd | [
"MIT"
] | 138 | 2020-02-08T05:25:26.000Z | 2021-11-04T11:59:28.000Z | String/415. Add Strings.py | beckswu/Leetcode | 480e8dc276b1f65961166d66efa5497d7ff0bdfd | [
"MIT"
] | null | null | null | String/415. Add Strings.py | beckswu/Leetcode | 480e8dc276b1f65961166d66efa5497d7ff0bdfd | [
"MIT"
] | 24 | 2021-01-02T07:18:43.000Z | 2022-03-20T08:17:54.000Z | """
415. Add Strings
"""
class Solution:
def addStrings(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
i = len(num1)-1; j = len(num2)-1
carry = 0
res = ""
while i >= 0 or j >= 0 or carry > 0:
... | 27.8 | 73 | 0.432682 |
class Solution:
def addStrings(self, num1, num2):
i = len(num1)-1; j = len(num2)-1
carry = 0
res = ""
while i >= 0 or j >= 0 or carry > 0:
carry += ord(num1[i]) - ord('0') if i >= 0 else 0
carry += ord(num2[j]) - ord('0') if j >= 0 else 0
... | true | true |
1c3aa727a7efd294cba76ebcbd5e4e98734126c2 | 8,378 | py | Python | src/callbacks/wandb_callbacks.py | Unity-Technologies/lightning-hydra-template | 4bdf4e62c6f93021d7fae86a51c5d706990a933d | [
"MIT"
] | 3 | 2021-04-30T20:50:19.000Z | 2021-09-25T09:39:46.000Z | src/callbacks/wandb_callbacks.py | Unity-Technologies/lightning-hydra-template | 4bdf4e62c6f93021d7fae86a51c5d706990a933d | [
"MIT"
] | null | null | null | src/callbacks/wandb_callbacks.py | Unity-Technologies/lightning-hydra-template | 4bdf4e62c6f93021d7fae86a51c5d706990a933d | [
"MIT"
] | 1 | 2022-02-10T18:20:20.000Z | 2022-02-10T18:20:20.000Z | import glob
import os
from typing import List
import matplotlib.pyplot as plt
import seaborn as sn
import torch
import wandb
from pytorch_lightning import Callback, Trainer
from pytorch_lightning.loggers import LoggerCollection, WandbLogger
from sklearn import metrics
from sklearn.metrics import f1_score, precision_sc... | 34.056911 | 116 | 0.620196 | import glob
import os
from typing import List
import matplotlib.pyplot as plt
import seaborn as sn
import torch
import wandb
from pytorch_lightning import Callback, Trainer
from pytorch_lightning.loggers import LoggerCollection, WandbLogger
from sklearn import metrics
from sklearn.metrics import f1_score, precision_sc... | true | true |
1c3aa7498c859db5061e314b79119fd96c0a1892 | 1,054 | py | Python | tests/test_perspective.py | gregunz/invertransforms | 3b0621c567d309ee054115cc90cb188808bd63b2 | [
"BSD-3-Clause"
] | 5 | 2019-10-14T18:56:08.000Z | 2019-10-17T13:50:11.000Z | tests/test_perspective.py | gregunz/invertransforms | 3b0621c567d309ee054115cc90cb188808bd63b2 | [
"BSD-3-Clause"
] | 1 | 2021-04-06T18:05:19.000Z | 2021-04-06T18:05:19.000Z | tests/test_perspective.py | gregunz/invertransforms | 3b0621c567d309ee054115cc90cb188808bd63b2 | [
"BSD-3-Clause"
] | null | null | null | import invertransforms as T
from invertransforms.lib import InvertibleError
from tests.invertible_test_case import InvertibleTestCase
class TestPerspective(InvertibleTestCase):
def test_invert_before_apply(self):
with self.assertRaises(InvertibleError):
T.RandomPerspective().inverse()
de... | 36.344828 | 78 | 0.701139 | import invertransforms as T
from invertransforms.lib import InvertibleError
from tests.invertible_test_case import InvertibleTestCase
class TestPerspective(InvertibleTestCase):
def test_invert_before_apply(self):
with self.assertRaises(InvertibleError):
T.RandomPerspective().inverse()
de... | true | true |
1c3aa8e1d7c7b7e9cb0b5311c357596b0f060e61 | 305 | py | Python | careless/models/likelihoods/base.py | JBGreisman/careless | 8f6c0859973757d11b26b65d9dc51d443030aa70 | [
"MIT"
] | 5 | 2021-02-08T16:34:38.000Z | 2022-03-25T19:16:09.000Z | careless/models/likelihoods/base.py | JBGreisman/careless | 8f6c0859973757d11b26b65d9dc51d443030aa70 | [
"MIT"
] | 28 | 2021-01-15T21:31:40.000Z | 2022-03-30T21:06:54.000Z | careless/models/likelihoods/base.py | JBGreisman/careless | 8f6c0859973757d11b26b65d9dc51d443030aa70 | [
"MIT"
] | 5 | 2021-02-12T18:43:58.000Z | 2022-02-02T21:38:56.000Z | from careless.models.base import BaseModel
class Likelihood(BaseModel):
def call(inputs):
raise NotImplementedError(
"Likelihoods must implement a call method that returns a `tfp.distribution.Distribution` "
"or a similar object with a `log_prob` method."
)
| 27.727273 | 102 | 0.678689 | from careless.models.base import BaseModel
class Likelihood(BaseModel):
def call(inputs):
raise NotImplementedError(
"Likelihoods must implement a call method that returns a `tfp.distribution.Distribution` "
"or a similar object with a `log_prob` method."
)
| true | true |
1c3aa996949639478b54efba258f458d4268313e | 888 | py | Python | petroflow/src/base_delegator.py | atwahsz/petroflow | 089ca9559a94a7b597cde94601999489ac43d5ec | [
"Apache-2.0"
] | 44 | 2019-10-15T07:03:14.000Z | 2022-01-11T09:09:24.000Z | petroflow/src/base_delegator.py | atwahsz/petroflow | 089ca9559a94a7b597cde94601999489ac43d5ec | [
"Apache-2.0"
] | 15 | 2019-10-18T07:51:45.000Z | 2022-03-10T21:17:16.000Z | petroflow/src/base_delegator.py | atwahsz/petroflow | 089ca9559a94a7b597cde94601999489ac43d5ec | [
"Apache-2.0"
] | 21 | 2019-10-30T14:21:54.000Z | 2022-03-23T16:19:34.000Z | """Implements base delegator - a metaclass that creates absent abstract
methods of `WellBatch` and `Well` classes."""
from abc import ABCMeta
class BaseDelegator(ABCMeta):
"""Base metaclass that searches for absent abstract methods and creates
them."""
def __new__(mcls, name, bases, namespace):
... | 37 | 111 | 0.69482 |
from abc import ABCMeta
class BaseDelegator(ABCMeta):
def __new__(mcls, name, bases, namespace):
abstract_methods = [base.__abstractmethods__ for base in bases if hasattr(base, "__abstractmethods__")]
abstract_methods = frozenset().union(*abstract_methods)
for method in abstract_methods:... | true | true |
1c3aa9b9d9095564eae877e1175073726df84e60 | 5,695 | py | Python | pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py | bouffalolab/pigweed | 455f460f729591c22c4581a962431c3712fe7ea6 | [
"Apache-2.0"
] | 1 | 2022-01-13T10:01:05.000Z | 2022-01-13T10:01:05.000Z | pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py | bouffalolab/pigweed | 455f460f729591c22c4581a962431c3712fe7ea6 | [
"Apache-2.0"
] | null | null | null | pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py | bouffalolab/pigweed | 455f460f729591c22c4581a962431c3712fe7ea6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 35.81761 | 87 | 0.659526 |
import argparse
import logging
import glob
from pathlib import Path
import sys
from typing import Collection, Iterable, Iterator
import serial from pw_tokenizer import database
from pw_trace import trace
from pw_hdlc.rpc import HdlcRpcClient, default_channels
from pw_hdlc.rpc_console import SocketClientImpl
from pw_t... | true | true |
1c3aabb2158795ae2257c0d560f1b866e0ca84a7 | 30,099 | py | Python | qq/http.py | foxwhite25/qq.py | 92e744205e57b4c8922aa5843095ae900b3c1d84 | [
"MIT"
] | 40 | 2021-12-07T02:18:14.000Z | 2022-03-28T13:14:16.000Z | qq/http.py | foxwhite25/qq.py | 92e744205e57b4c8922aa5843095ae900b3c1d84 | [
"MIT"
] | 2 | 2021-12-12T17:34:29.000Z | 2021-12-17T04:43:03.000Z | qq/http.py | foxwhite25/qq.py | 92e744205e57b4c8922aa5843095ae900b3c1d84 | [
"MIT"
] | 5 | 2021-12-10T11:17:41.000Z | 2022-03-05T13:53:50.000Z | # The MIT License (MIT)
# Copyright (c) 2021-present foxwhite25
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, ... | 36.089928 | 119 | 0.573973 |
from __future__ import annotations
import asyncio
import datetime
import logging
import sys
import weakref
from types import TracebackType
from typing import (
ClassVar, Any, Optional, Dict, Union, TypeVar, Type,
Coroutine, List, Tuple, TYPE_CHECKING, NamedTuple
)
from urllib.parse import quote as _uriquote
... | true | true |
1c3aacb6c616d830effc8166735c00bdd26092f7 | 1,288 | py | Python | htpanel/app.py | mpavelka/htpasswd-webpanel | eba3f270316ea288e41491ef27f7f45bb219aeef | [
"MIT"
] | null | null | null | htpanel/app.py | mpavelka/htpasswd-webpanel | eba3f270316ea288e41491ef27f7f45bb219aeef | [
"MIT"
] | null | null | null | htpanel/app.py | mpavelka/htpasswd-webpanel | eba3f270316ea288e41491ef27f7f45bb219aeef | [
"MIT"
] | null | null | null | import asab
import asab.web
import logging
import os
from .template import Jinja2TemplateService
from .url import URLService
from .htpasswd.handler import HtpasswdHandler
from .htpasswd.service import HtpasswdService
###
L = logging.getLogger(__name__)
###
asab.Config.add_defaults({
"htpasswd_webpanel": {
"secr... | 22.596491 | 88 | 0.710404 | import asab
import asab.web
import logging
import os
from .template import Jinja2TemplateService
from .url import URLService
from .htpasswd.handler import HtpasswdHandler
from .htpasswd.service import HtpasswdService
L = logging.getLogger(__name__)
asab.Config.add_defaults({
"htpasswd_webpanel": {
"secret": "",... | true | true |
1c3aadbf71b01cdadf7ef4006970fff5e47739a5 | 4,907 | py | Python | data/data_utils.py | zheang01/FACT | a877cc86acc4d29fb7589c8ac571c8aef09e5fd8 | [
"MIT"
] | 65 | 2021-06-14T16:16:40.000Z | 2022-03-30T03:10:52.000Z | data/data_utils.py | zheang01/FACT | a877cc86acc4d29fb7589c8ac571c8aef09e5fd8 | [
"MIT"
] | 5 | 2021-07-14T06:58:38.000Z | 2021-11-29T10:52:27.000Z | data/data_utils.py | zheang01/FACT | a877cc86acc4d29fb7589c8ac571c8aef09e5fd8 | [
"MIT"
] | 13 | 2021-06-14T16:16:40.000Z | 2022-03-14T12:29:19.000Z | from torchvision import transforms
import random
import torch
import numpy as np
from math import sqrt
def dataset_info(filepath):
with open(filepath, 'r') as f:
images_list = f.readlines()
file_names = []
labels = []
for row in images_list:
row = row.strip().split(' ')
... | 39.572581 | 116 | 0.539637 | from torchvision import transforms
import random
import torch
import numpy as np
from math import sqrt
def dataset_info(filepath):
with open(filepath, 'r') as f:
images_list = f.readlines()
file_names = []
labels = []
for row in images_list:
row = row.strip().split(' ')
... | true | true |
1c3aaee898c9af4b492728a688ea91e279cfa236 | 59,831 | py | Python | pysnmp/XUPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/XUPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/XUPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module XUPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XUPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:38:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | 157.865435 | 10,518 | 0.73619 | Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.impo... | true | true |
1c3aaefe05715e4b4a91554a88789cdcc9ea6606 | 677 | py | Python | sheepdoge/app.py | mattjmcnaughton/sheepdoge | 9c028d6f51cb59afcaf25a5680f961ec7e25676b | [
"Apache-2.0"
] | 7 | 2018-03-18T07:25:10.000Z | 2022-01-28T17:35:08.000Z | sheepdoge/app.py | mattjmcnaughton/sheepdoge | 9c028d6f51cb59afcaf25a5680f961ec7e25676b | [
"Apache-2.0"
] | 15 | 2017-08-19T14:03:10.000Z | 2017-12-29T23:22:05.000Z | sheepdoge/app.py | mattjmcnaughton/sheepdoge | 9c028d6f51cb59afcaf25a5680f961ec7e25676b | [
"Apache-2.0"
] | null | null | null | """Orchestrates the different `sheepdoge` operations."""
from sheepdoge.config import Config
from sheepdoge.action import Action # pylint: disable=unused-import
class Sheepdoge(object):
"""A class we instantiate with instances of the `Action`, which indicate
which cli command we'll perform.
:param acti... | 29.434783 | 76 | 0.66322 |
from sheepdoge.config import Config
from sheepdoge.action import Action
class Sheepdoge(object):
def __init__(self, action, config=None):
self._action = action
self._config = config or Config.get_config_singleton()
def run(self):
self._action.run()
| true | true |
1c3ab0b0932c8237da05d6071187d05b66064048 | 3,915 | py | Python | torchpq/legacy/IVFPQTopk.py | mhamilton723/TorchPQ | f3d560ec04d9c741943fa930a1257c9be9445cbe | [
"MIT"
] | 103 | 2021-02-10T18:01:56.000Z | 2022-03-30T21:35:05.000Z | torchpq/legacy/IVFPQTopk.py | mhamilton723/TorchPQ | f3d560ec04d9c741943fa930a1257c9be9445cbe | [
"MIT"
] | 9 | 2021-05-28T14:52:33.000Z | 2022-03-03T13:09:25.000Z | torchpq/legacy/IVFPQTopk.py | mhamilton723/TorchPQ | f3d560ec04d9c741943fa930a1257c9be9445cbe | [
"MIT"
] | 10 | 2021-04-24T04:25:24.000Z | 2022-02-24T07:30:42.000Z | import torch
import numpy as np
import math
from ..kernels import ComputeProductCuda
class IVFPQTopk:
def __init__(self,
n_subvectors,
n_clusters,
n_cs=4,
):
assert torch.cuda.is_available()
self.n_subvectors = n_subvectors
self.n_clusters = n_clusters
self.n_cs = n_cs
self.sm_siz... | 32.090164 | 83 | 0.637292 | import torch
import numpy as np
import math
from ..kernels import ComputeProductCuda
class IVFPQTopk:
def __init__(self,
n_subvectors,
n_clusters,
n_cs=4,
):
assert torch.cuda.is_available()
self.n_subvectors = n_subvectors
self.n_clusters = n_clusters
self.n_cs = n_cs
self.sm_siz... | true | true |
1c3ab1668f9b0b952c25c52d791afe7807b62859 | 10,702 | py | Python | tanjun/__init__.py | thesadru/Tanjun | 977eacbd2b0eeafd14a30450aceeb9e329703edd | [
"BSD-3-Clause"
] | null | null | null | tanjun/__init__.py | thesadru/Tanjun | 977eacbd2b0eeafd14a30450aceeb9e329703edd | [
"BSD-3-Clause"
] | null | null | null | tanjun/__init__.py | thesadru/Tanjun | 977eacbd2b0eeafd14a30450aceeb9e329703edd | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2022, Faster Speeding
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sour... | 33.548589 | 100 | 0.769576 | from __future__ import annotations
__all__: list[str] = [
"AnyHooks",
"BucketResource",
"Client",
"ClientCallbackNames",
"CommandError",
"Component",
"ConversionError",
"FailedCheck",
"FailedModuleLoad",
"FailedModuleUnload",
"HaltExecution",
"Hooks",
"InMemoryCo... | true | true |
1c3ab1ef5f86b0cd1cd75c356f7f133390e6603d | 47,320 | py | Python | cwltool/command_line_tool.py | giannisdoukas/cwltool | 5a29b0742b8387f1ce8fc11e9b408a3b636432ee | [
"Apache-2.0"
] | null | null | null | cwltool/command_line_tool.py | giannisdoukas/cwltool | 5a29b0742b8387f1ce8fc11e9b408a3b636432ee | [
"Apache-2.0"
] | null | null | null | cwltool/command_line_tool.py | giannisdoukas/cwltool | 5a29b0742b8387f1ce8fc11e9b408a3b636432ee | [
"Apache-2.0"
] | null | null | null | """Implementation of CommandLineTool."""
import copy
import hashlib
import json
import locale
import logging
import os
import re
import shutil
import tempfile
import threading
import urllib
from functools import cmp_to_key, partial
from typing import (
Any,
Callable,
Dict,
Generator,
List,
Mapp... | 39.697987 | 101 | 0.501078 |
import copy
import hashlib
import json
import locale
import logging
import os
import re
import shutil
import tempfile
import threading
import urllib
from functools import cmp_to_key, partial
from typing import (
Any,
Callable,
Dict,
Generator,
List,
Mapping,
MutableMapping,
MutableSeque... | true | true |
1c3ab21238dd0f028ba1695c2193bb7d985c1df8 | 1,899 | py | Python | run.py | SimonLaplacing/Lattice_Planner | bb2b7a0311f261b7ad333688044be50585bcb6f5 | [
"MIT"
] | null | null | null | run.py | SimonLaplacing/Lattice_Planner | bb2b7a0311f261b7ad333688044be50585bcb6f5 | [
"MIT"
] | null | null | null | run.py | SimonLaplacing/Lattice_Planner | bb2b7a0311f261b7ad333688044be50585bcb6f5 | [
"MIT"
] | 1 | 2022-02-18T06:13:59.000Z | 2022-02-18T06:13:59.000Z | import glob
import os
import sys
import gym
import carla_gym
import inspect
import argparse
import numpy as np
import os.path as osp
from pathlib import Path
currentPath = osp.dirname(osp.abspath(inspect.getfile(inspect.currentframe())))
# sys.path.insert(1, currentPath + '/agents/stable_baselines/')
import shutil
fro... | 35.830189 | 128 | 0.679305 | import glob
import os
import sys
import gym
import carla_gym
import inspect
import argparse
import numpy as np
import os.path as osp
from pathlib import Path
currentPath = osp.dirname(osp.abspath(inspect.getfile(inspect.currentframe())))
import shutil
from config import cfg, log_config_to_file, cfg_from_list, cfg_from... | true | true |
1c3ab214cffa2f8e86e722767cbaba250cd2f557 | 4,854 | py | Python | provisioning/profile.py | manicmaniac/provisioning | ca29b9ee6f4274489bbf8fbc79b44ebcfc22e66a | [
"MIT"
] | 4 | 2018-11-05T10:33:57.000Z | 2019-10-11T16:12:15.000Z | provisioning/profile.py | manicmaniac/provisioning | ca29b9ee6f4274489bbf8fbc79b44ebcfc22e66a | [
"MIT"
] | null | null | null | provisioning/profile.py | manicmaniac/provisioning | ca29b9ee6f4274489bbf8fbc79b44ebcfc22e66a | [
"MIT"
] | 2 | 2021-01-21T03:45:54.000Z | 2021-12-30T00:55:50.000Z | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import plistlib
import uuid
import getpass
import platform
import os
from datetime import datetime
from OpenSSL.crypto import FILETYPE_ASN1, load_certificate
from entitlements import Entitlements
class ProvisioningProfile(object):
'''
Apple's provisioning profile.... | 27.117318 | 86 | 0.585909 |
import plistlib
import uuid
import getpass
import platform
import os
from datetime import datetime
from OpenSSL.crypto import FILETYPE_ASN1, load_certificate
from entitlements import Entitlements
class ProvisioningProfile(object):
def __init__(self, data):
self._data = data
self._plist = self._ex... | true | true |
1c3ab2c57a386d99a67787a8c1d69ac297abe034 | 2,586 | py | Python | securitycenter/noxfile.py | deryrahman/google-cloud-python | b55058c4b2328fde32f29bfd8ea04708fcc578e0 | [
"Apache-2.0"
] | 1 | 2020-10-25T04:39:41.000Z | 2020-10-25T04:39:41.000Z | securitycenter/noxfile.py | deryrahman/google-cloud-python | b55058c4b2328fde32f29bfd8ea04708fcc578e0 | [
"Apache-2.0"
] | 4 | 2018-11-13T22:15:36.000Z | 2018-12-07T18:31:38.000Z | securitycenter/noxfile.py | deryrahman/google-cloud-python | b55058c4b2328fde32f29bfd8ea04708fcc578e0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017, Google LLC 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... | 28.733333 | 75 | 0.651585 |
from __future__ import absolute_import
import os
import nox
LOCAL_DEPS = (
os.path.join('..', 'api_core'),
os.path.join('..', 'core'),
)
def default(session):
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
session.install('-e', '.')
session.run(
'py.test',
'--qui... | true | true |
1c3ab3b2e1c2b3127edc2cd733cf4b3563ef3be9 | 1,793 | py | Python | setup.py | tylerdave/baxter | 4c972e060c21f5d2b6d55dbbdb4407abf2e41cb1 | [
"MIT"
] | null | null | null | setup.py | tylerdave/baxter | 4c972e060c21f5d2b6d55dbbdb4407abf2e41cb1 | [
"MIT"
] | null | null | null | setup.py | tylerdave/baxter | 4c972e060c21f5d2b6d55dbbdb4407abf2e41cb1 | [
"MIT"
] | null | null | null | """A setuptools based setup module for Baxter"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from codecs import open
from os import path
from setuptools import setup, find_packages
import versioneer
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as readme_fi... | 29.393443 | 76 | 0.643614 |
from codecs import open
from os import path
from setuptools import setup, find_packages
import versioneer
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as readme_file:
readme = readme_file.read()
with open(path.join(here, 'HISTORY.rst'), encoding='utf-8'... | true | true |
1c3ab5d14a60389fd672956ef912ecce50ed78dc | 2,359 | py | Python | src/python/zensols/garmdown/backup.py | garmin-data/garmdown | 5f466ebb0b9450890d5fc75336ccafa3654a9464 | [
"MIT"
] | 14 | 2020-01-13T10:39:35.000Z | 2021-12-19T13:17:46.000Z | src/python/zensols/garmdown/backup.py | garmin-data/garmdown | 5f466ebb0b9450890d5fc75336ccafa3654a9464 | [
"MIT"
] | 4 | 2020-02-28T08:39:17.000Z | 2021-02-28T19:05:06.000Z | src/python/zensols/garmdown/backup.py | garmin-data/garmdown | 5f466ebb0b9450890d5fc75336ccafa3654a9464 | [
"MIT"
] | 6 | 2020-04-22T06:12:07.000Z | 2022-01-02T13:25:24.000Z | import logging
from pathlib import Path
from datetime import datetime
import shutil as su
from zensols.persist import persisted
from zensols.garmdown import (
Backup,
Persister,
)
logger = logging.getLogger(__name__)
class Backuper(object):
"""Backup the SQLite database on a periodic basis.
"""
... | 31.039474 | 86 | 0.607037 | import logging
from pathlib import Path
from datetime import datetime
import shutil as su
from zensols.persist import persisted
from zensols.garmdown import (
Backup,
Persister,
)
logger = logging.getLogger(__name__)
class Backuper(object):
def __init__(self, config):
self.config = config
... | true | true |
1c3ab77fe89a139978bf23a2f6badb56e94347eb | 463 | py | Python | divisors.py | nikithaanil/practice_python | 0afc06573dc2df684bc5afcf77d47057fe4811bb | [
"MIT"
] | null | null | null | divisors.py | nikithaanil/practice_python | 0afc06573dc2df684bc5afcf77d47057fe4811bb | [
"MIT"
] | null | null | null | divisors.py | nikithaanil/practice_python | 0afc06573dc2df684bc5afcf77d47057fe4811bb | [
"MIT"
] | null | null | null | '''Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
(If you don’t know what a divisor is, it is a number that divides evenly into another number.
For example, 13 is a divisor of 26 because 26 / 13 has no remainder.)'''
num=int(input("enter a number: "))
li... | 30.866667 | 114 | 0.693305 |
num=int(input("enter a number: "))
limit=num+1
divisor_list=[]
for i in range(1,limit):
if num % i == 0:
divisor_list.append(i)
print(divisor_list)
| true | true |
1c3ab89982bccb51263a24e9dabba740aa178000 | 246 | py | Python | examples/congratulations_app/setup.py | maximsakhno/galo-ioc | d300cc0e63e6ad375b7d2e75ac2b2e2fda30da4f | [
"MIT"
] | 9 | 2022-01-16T11:45:00.000Z | 2022-03-23T07:42:24.000Z | examples/congratulations_app/setup.py | maximsakhno/galo-ioc | d300cc0e63e6ad375b7d2e75ac2b2e2fda30da4f | [
"MIT"
] | 2 | 2022-01-16T12:03:14.000Z | 2022-01-16T12:11:27.000Z | examples/congratulations_app/setup.py | maximsakhno/galo-ioc | d300cc0e63e6ad375b7d2e75ac2b2e2fda30da4f | [
"MIT"
] | null | null | null | from setuptools import find_packages, setup
setup(
name="congratulations-app",
version="0.1.0",
author="Maxim Sakhno",
author_email="maxim.sakhno@iqtek.ru",
packages=find_packages(where="src"),
package_dir={"": "src"},
)
| 22.363636 | 43 | 0.670732 | from setuptools import find_packages, setup
setup(
name="congratulations-app",
version="0.1.0",
author="Maxim Sakhno",
author_email="maxim.sakhno@iqtek.ru",
packages=find_packages(where="src"),
package_dir={"": "src"},
)
| true | true |
1c3ab918d5b7e639c71ebfccc8ec4f95dda7aa5e | 24,047 | py | Python | plugins/keepkey/qt.py | D3m0nKingx/electrum-ganja | be204713107626f3e334e9fd5974c044a9f2ffb6 | [
"MIT"
] | null | null | null | plugins/keepkey/qt.py | D3m0nKingx/electrum-ganja | be204713107626f3e334e9fd5974c044a9f2ffb6 | [
"MIT"
] | null | null | null | plugins/keepkey/qt.py | D3m0nKingx/electrum-ganja | be204713107626f3e334e9fd5974c044a9f2ffb6 | [
"MIT"
] | null | null | null | from functools import partial
import threading
from PyQt5.Qt import Qt
from PyQt5.Qt import QGridLayout, QInputDialog, QPushButton
from PyQt5.Qt import QVBoxLayout, QLabel
from electrum_ganja_gui.qt.util import *
from electrum_ganja.i18n import _
from electrum_ganja.plugins import hook, DeviceMgr
from electrum_ganja.... | 40.965928 | 83 | 0.617749 | from functools import partial
import threading
from PyQt5.Qt import Qt
from PyQt5.Qt import QGridLayout, QInputDialog, QPushButton
from PyQt5.Qt import QVBoxLayout, QLabel
from electrum_ganja_gui.qt.util import *
from electrum_ganja.i18n import _
from electrum_ganja.plugins import hook, DeviceMgr
from electrum_ganja.... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.