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 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7467a3e6d77d4ed54fcc40ed69a9b17b82a8341 | 27,908 | py | Python | src/virtual-wan/azext_vwan/vendored_sdks/v2021_03_01/v2021_03_01/aio/operations/_security_partner_providers_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/virtual-wan/azext_vwan/vendored_sdks/v2021_03_01/v2021_03_01/aio/operations/_security_partner_providers_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/virtual-wan/azext_vwan/vendored_sdks/v2021_03_01/v2021_03_01/aio/operations/_security_partner_providers_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.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 ... | 51.490775 | 217 | 0.681131 |
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 ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.... | true | true |
f7467a43632fcf5a37b5c7f91d37d4b9596aa837 | 772 | py | Python | Defs/ex111/utilidadesCeV/funcao/__init__.py | Dioclesiano/Python | ba9166048fe824fef96fcf6cf3696714e79f4235 | [
"MIT"
] | null | null | null | Defs/ex111/utilidadesCeV/funcao/__init__.py | Dioclesiano/Python | ba9166048fe824fef96fcf6cf3696714e79f4235 | [
"MIT"
] | null | null | null | Defs/ex111/utilidadesCeV/funcao/__init__.py | Dioclesiano/Python | ba9166048fe824fef96fcf6cf3696714e79f4235 | [
"MIT"
] | null | null | null | def resumo(n, credito, debito, brasao='R$', conversao=False):
moeda(n, brasao)
print('-'*60)
print('RESULTADO'.center(60))
print('-'*60)
print(f'O juros de {credito}% sobre {moeda(n, brasao)} corresponde a \t{aumentar(n, credito, brasao, conversao)}')
print(f'O desconto de {debito}% sobre {moed... | 33.565217 | 119 | 0.648964 | def resumo(n, credito, debito, brasao='R$', conversao=False):
moeda(n, brasao)
print('-'*60)
print('RESULTADO'.center(60))
print('-'*60)
print(f'O juros de {credito}% sobre {moeda(n, brasao)} corresponde a \t{aumentar(n, credito, brasao, conversao)}')
print(f'O desconto de {debito}% sobre {moed... | true | true |
f7467a8d2938826771969c63f8dfda3640e2461c | 6,027 | py | Python | custom_components/eldes_alarm/core/eldes_cloud.py | evaliukonis/eldes | 32c3e24effdd6b109b1199d85f174eddd2c602a4 | [
"MIT"
] | null | null | null | custom_components/eldes_alarm/core/eldes_cloud.py | evaliukonis/eldes | 32c3e24effdd6b109b1199d85f174eddd2c602a4 | [
"MIT"
] | null | null | null | custom_components/eldes_alarm/core/eldes_cloud.py | evaliukonis/eldes | 32c3e24effdd6b109b1199d85f174eddd2c602a4 | [
"MIT"
] | null | null | null | """Implementation for Eldes Cloud"""
import asyncio
import async_timeout
import logging
import aiohttp
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_DISARMED
)
from ..const import API_URL, API_PATHS
_LOGGER = logging.getLogger(__name__)
ALARM_STATES_MAP = ... | 25.978448 | 129 | 0.558653 | import asyncio
import async_timeout
import logging
import aiohttp
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_DISARMED
)
from ..const import API_URL, API_PATHS
_LOGGER = logging.getLogger(__name__)
ALARM_STATES_MAP = {
"DISARMED": STATE_ALARM_DISARME... | true | true |
f7467c8775c1f95a0719aaff5fcc019f3e357d78 | 426 | py | Python | graphsaint/setup.py | wohlbier/GraphSAINT | cea64e77d97b77d76b05fba17cbfaa0d985d9aa3 | [
"MIT"
] | null | null | null | graphsaint/setup.py | wohlbier/GraphSAINT | cea64e77d97b77d76b05fba17cbfaa0d985d9aa3 | [
"MIT"
] | null | null | null | graphsaint/setup.py | wohlbier/GraphSAINT | cea64e77d97b77d76b05fba17cbfaa0d985d9aa3 | [
"MIT"
] | null | null | null | # cython: language_level=3
from distutils.core import setup, Extension
from Cython.Build import cythonize
import numpy
# import cython_utils
import os
os.environ["CC"] = "g++"
os.environ["CXX"] = "g++"
setup(ext_modules = cythonize(["graphsaint/cython_sampler.pyx","graphsaint/cython_utils.pyx","graphsaint/norm_aggr.p... | 32.769231 | 160 | 0.762911 |
from distutils.core import setup, Extension
from Cython.Build import cythonize
import numpy
import os
os.environ["CC"] = "g++"
os.environ["CXX"] = "g++"
setup(ext_modules = cythonize(["graphsaint/cython_sampler.pyx","graphsaint/cython_utils.pyx","graphsaint/norm_aggr.pyx"]), include_dirs = [numpy.get_include()])
| true | true |
f7467d5e3c76937ae35619a311e263f79f7f5de1 | 63,016 | py | Python | python/ray/serve/deployment_state.py | niuguy/ray | 37ef372a10fccca7e4d18dc48cd900f9d2fd159f | [
"Apache-2.0"
] | null | null | null | python/ray/serve/deployment_state.py | niuguy/ray | 37ef372a10fccca7e4d18dc48cd900f9d2fd159f | [
"Apache-2.0"
] | null | null | null | python/ray/serve/deployment_state.py | niuguy/ray | 37ef372a10fccca7e4d18dc48cd900f9d2fd159f | [
"Apache-2.0"
] | null | null | null | from collections import defaultdict, OrderedDict
from enum import Enum
import json
import math
import os
import pickle
import random
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
import ray
from ray import ObjectRef
from ray.actor import ActorHandle
from ray.exceptions import RayActorError,... | 38.707617 | 98 | 0.626746 | from collections import defaultdict, OrderedDict
from enum import Enum
import json
import math
import os
import pickle
import random
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
import ray
from ray import ObjectRef
from ray.actor import ActorHandle
from ray.exceptions import RayActorError,... | true | true |
f7467f05fae463872907ecc5078c11e551362a19 | 2,108 | py | Python | photos/views.py | omololevy/Gallery | ed7760b514c355da90904b4cf7c93c9910e59866 | [
"MIT"
] | 3 | 2021-12-25T23:11:15.000Z | 2022-01-08T17:40:39.000Z | photos/views.py | omololevy/Gallery | ed7760b514c355da90904b4cf7c93c9910e59866 | [
"MIT"
] | null | null | null | photos/views.py | omololevy/Gallery | ed7760b514c355da90904b4cf7c93c9910e59866 | [
"MIT"
] | null | null | null | from django.shortcuts import render,redirect
from .models import Image
from .forms import UploadForm
from django.db.models import Q
from django.db.models.base import ObjectDoesNotExist
from django.http import HttpResponse,Http404
def home(request):
pictures = Image.objects.all()
ctx = {'pictures':pictures}
... | 32.430769 | 108 | 0.653226 | from django.shortcuts import render,redirect
from .models import Image
from .forms import UploadForm
from django.db.models import Q
from django.db.models.base import ObjectDoesNotExist
from django.http import HttpResponse,Http404
def home(request):
pictures = Image.objects.all()
ctx = {'pictures':pictures}
... | true | true |
f7468182fd40781c002e397fd19fd1370271eceb | 5,868 | py | Python | helpdesk/management/commands/escalate_tickets.py | tqangxl/django-helpdesk | 3d7bcb4928f54e7978e6ba39accda12865ebae26 | [
"CC-BY-3.0",
"BSD-3-Clause"
] | 1 | 2019-04-12T02:42:45.000Z | 2019-04-12T02:42:45.000Z | helpdesk/management/commands/escalate_tickets.py | tqangxl/django-helpdesk | 3d7bcb4928f54e7978e6ba39accda12865ebae26 | [
"CC-BY-3.0",
"BSD-3-Clause"
] | 1 | 2019-07-16T13:55:09.000Z | 2019-07-16T13:55:09.000Z | helpdesk/management/commands/escalate_tickets.py | tqangxl/django-helpdesk | 3d7bcb4928f54e7978e6ba39accda12865ebae26 | [
"CC-BY-3.0",
"BSD-3-Clause"
] | 1 | 2019-07-08T16:23:22.000Z | 2019-07-08T16:23:22.000Z | #!/usr/bin/python
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
scripts/escalate_tickets.py - Easy way to escalate tickets based on their age,
designed to be run from Cron or similar.
""... | 29.786802 | 89 | 0.54499 |
from __future__ import print_function
from datetime import timedelta, date
import getopt
from optparse import make_option
import sys
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from django.utils.translation import ugettext as _
try:
from django.utils import t... | true | true |
f74682bbfa40eadd5fe5981e3998b9389f1629fc | 30,769 | py | Python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/operations/_network_security_groups_operations.py | beltr0n/azure-sdk-for-python | 2f7fb8bee881b0fc0386a0ad5385755ceedd0453 | [
"MIT"
] | 2 | 2021-03-24T06:26:11.000Z | 2021-04-18T15:55:59.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/operations/_network_security_groups_operations.py | beltr0n/azure-sdk-for-python | 2f7fb8bee881b0fc0386a0ad5385755ceedd0453 | [
"MIT"
] | 4 | 2019-04-17T17:57:49.000Z | 2020-04-24T21:11:22.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/operations/_network_security_groups_operations.py | beltr0n/azure-sdk-for-python | 2f7fb8bee881b0fc0386a0ad5385755ceedd0453 | [
"MIT"
] | 2 | 2021-05-23T16:46:31.000Z | 2021-05-26T23:51:09.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 ... | 49.949675 | 211 | 0.668823 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport impor... | true | true |
f7468314c762cc0a7911f4b43d569a39f01c09b0 | 124 | py | Python | DIY_NN/solutions/ff_compute_gradient.py | PinmanHuang/CrashCourseML | b59ebf138d42fc9a1669735c6363d50938200e69 | [
"MIT"
] | 3 | 2019-02-16T05:57:09.000Z | 2019-09-16T07:07:18.000Z | DIY_NN/solutions/ff_compute_gradient.py | PinmanHuang/CrashCourseML | b59ebf138d42fc9a1669735c6363d50938200e69 | [
"MIT"
] | null | null | null | DIY_NN/solutions/ff_compute_gradient.py | PinmanHuang/CrashCourseML | b59ebf138d42fc9a1669735c6363d50938200e69 | [
"MIT"
] | 8 | 2019-02-14T02:51:26.000Z | 2019-10-07T07:44:24.000Z | p = np.eye(3)[y][:, None]
grad_d = q - p
grad_C = grad_d @ U.T
grad_b = (C.T @ grad_d ) * Drelu(A@x+b)
grad_A = grad_b @ x.T | 24.8 | 39 | 0.564516 | p = np.eye(3)[y][:, None]
grad_d = q - p
grad_C = grad_d @ U.T
grad_b = (C.T @ grad_d ) * Drelu(A@x+b)
grad_A = grad_b @ x.T | true | true |
f74684978a80111e4cff8855e884ee278229b775 | 2,478 | py | Python | taiga/webhooks/models.py | threefoldtech/Threefold-Circles | cbc433796b25cf7af9a295af65d665a4a279e2d6 | [
"Apache-2.0"
] | null | null | null | taiga/webhooks/models.py | threefoldtech/Threefold-Circles | cbc433796b25cf7af9a295af65d665a4a279e2d6 | [
"Apache-2.0"
] | 12 | 2019-11-25T14:08:32.000Z | 2021-06-24T10:35:51.000Z | taiga/webhooks/models.py | threefoldtech/Threefold-Circles | cbc433796b25cf7af9a295af65d665a4a279e2d6 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | 48.588235 | 105 | 0.711864 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from taiga.base.db.models.fields import JSONField
class Webhook(models.Model):
project = models.ForeignKey("projects.Project", null=False, blank=False,
related_name="webhooks")
... | true | true |
f74684ee9030ef0ef44538ae53fa4320456a667a | 2,723 | py | Python | analytical/templatetags/analytical.py | jayhaluska/django-analytical | 3a652cd6bce737e6b15ecee84b44bb9f42c688a7 | [
"MIT"
] | null | null | null | analytical/templatetags/analytical.py | jayhaluska/django-analytical | 3a652cd6bce737e6b15ecee84b44bb9f42c688a7 | [
"MIT"
] | null | null | null | analytical/templatetags/analytical.py | jayhaluska/django-analytical | 3a652cd6bce737e6b15ecee84b44bb9f42c688a7 | [
"MIT"
] | null | null | null | """
Analytical template tags and filters.
"""
from __future__ import absolute_import
import logging
from django import template
from django.template import Node, TemplateSyntaxError
from importlib import import_module
from analytical.utils import AnalyticalException
TAG_LOCATIONS = ['head_top', 'head_bottom', 'bo... | 27.785714 | 78 | 0.682336 |
from __future__ import absolute_import
import logging
from django import template
from django.template import Node, TemplateSyntaxError
from importlib import import_module
from analytical.utils import AnalyticalException
TAG_LOCATIONS = ['head_top', 'head_bottom', 'body_top', 'body_bottom']
TAG_POSITIONS = ['firs... | true | true |
f746859468e06be5f14625940d20799989d56d50 | 615 | py | Python | codedigger/social_auth/google.py | prayutsu/Backend | 944c37f0941fc6836a04c5bb85936558b9b30cff | [
"Apache-2.0"
] | null | null | null | codedigger/social_auth/google.py | prayutsu/Backend | 944c37f0941fc6836a04c5bb85936558b9b30cff | [
"Apache-2.0"
] | null | null | null | codedigger/social_auth/google.py | prayutsu/Backend | 944c37f0941fc6836a04c5bb85936558b9b30cff | [
"Apache-2.0"
] | 1 | 2021-09-29T13:01:34.000Z | 2021-09-29T13:01:34.000Z | from google.auth.transport import requests
from google.oauth2 import id_token
class Google:
"""Google class to fetch the user info and return it"""
@staticmethod
def validate(auth_token):
"""
validate method Queries the Google oAUTH2 api to fetch the user info
"""
try:
... | 29.285714 | 76 | 0.582114 | from google.auth.transport import requests
from google.oauth2 import id_token
class Google:
@staticmethod
def validate(auth_token):
try:
idinfo = id_token.verify_oauth2_token(auth_token,
requests.Request())
if 'accounts.google.... | true | true |
f74686e9932e89d49f6fc6ccad48fb7c67e2b608 | 3,371 | py | Python | sacrerouge/tests/metrics/blanc_test.py | CogComp/stat-analysis-experiments | f4662d2c6ae4f7f549c9bb8fe8d49f3a786af4f3 | [
"Apache-2.0"
] | 1 | 2022-03-30T13:39:10.000Z | 2022-03-30T13:39:10.000Z | sacrerouge/tests/metrics/blanc_test.py | CogComp/stat-analysis-experiments | f4662d2c6ae4f7f549c9bb8fe8d49f3a786af4f3 | [
"Apache-2.0"
] | null | null | null | sacrerouge/tests/metrics/blanc_test.py | CogComp/stat-analysis-experiments | f4662d2c6ae4f7f549c9bb8fe8d49f3a786af4f3 | [
"Apache-2.0"
] | 1 | 2021-12-05T14:55:10.000Z | 2021-12-05T14:55:10.000Z | import unittest
from sacrerouge.common.testing.metric_test_cases import DocumentBasedMetricTestCase
from sacrerouge.common.testing.util import sacrerouge_command_exists
from sacrerouge.metrics import Blanc
from sacrerouge.metrics.blanc import BLANC_INSTALLED
@unittest.skipIf(not BLANC_INSTALLED, '"blanc" not install... | 51.861538 | 123 | 0.689706 | import unittest
from sacrerouge.common.testing.metric_test_cases import DocumentBasedMetricTestCase
from sacrerouge.common.testing.util import sacrerouge_command_exists
from sacrerouge.metrics import Blanc
from sacrerouge.metrics.blanc import BLANC_INSTALLED
@unittest.skipIf(not BLANC_INSTALLED, '"blanc" not install... | true | true |
f746881b6d4ef39a1ba2318f77cf1f3667e8274e | 2,616 | py | Python | data/p4VQE/R2/benchmark/startQiskit_QC77.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R2/benchmark/startQiskit_QC77.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R2/benchmark/startQiskit_QC77.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=3
# total number=12
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... | 27.829787 | 118 | 0.636468 |
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from qiskit.tes... | true | true |
f746895e9fbef0941f223b9b48f165b7501e2a5c | 2,403 | py | Python | Device_Tests/camera_model/camera_model.py | maxbot5/Ball-Handle-Software | fe1b04c3f252a9e6848c2e79601f5633473abb28 | [
"MIT"
] | null | null | null | Device_Tests/camera_model/camera_model.py | maxbot5/Ball-Handle-Software | fe1b04c3f252a9e6848c2e79601f5633473abb28 | [
"MIT"
] | null | null | null | Device_Tests/camera_model/camera_model.py | maxbot5/Ball-Handle-Software | fe1b04c3f252a9e6848c2e79601f5633473abb28 | [
"MIT"
] | null | null | null | import math as ma
# test_data = 400,1280/2 #test input
test_data = 150, 68
hight = 495-114 #mm
#ball parameter
r_ball = 114.8 #mm
#angles
ang_cam_tilt = ma.radians(30)
ang_rev_cam_tilt = ma.radians(90)-ang_cam_tilt
ang_cam_flare_X = ma.radians(47) #Öffnungswinkel pixy cam
ang_cam_flare_Y = ma.radians(75)
'PIXY Par... | 29.304878 | 99 | 0.733666 | import math as ma
= 150, 68
hight = 495-114
r_ball = 114.8
ang_cam_tilt = ma.radians(30)
ang_rev_cam_tilt = ma.radians(90)-ang_cam_tilt
ang_cam_flare_X = ma.radians(47)
ang_cam_flare_Y = ma.radians(75)
X_cam_pixel = 800
Y_cam_pixel = 1280
ang_offset = ma.radians(30) et = 463 x_image_cam = 0
delta_X_image_c... | true | true |
f746895fcb8ae9818b1a7c41668e02a5a69ab672 | 5,679 | py | Python | evap/evaluation/templatetags/evaluation_filters.py | pixunil/EvaP | e1311bf8ca48a7d8d71449cc2bd3c01a07a18fe8 | [
"MIT"
] | null | null | null | evap/evaluation/templatetags/evaluation_filters.py | pixunil/EvaP | e1311bf8ca48a7d8d71449cc2bd3c01a07a18fe8 | [
"MIT"
] | null | null | null | evap/evaluation/templatetags/evaluation_filters.py | pixunil/EvaP | e1311bf8ca48a7d8d71449cc2bd3c01a07a18fe8 | [
"MIT"
] | 1 | 2019-04-23T19:48:59.000Z | 2019-04-23T19:48:59.000Z | from collections import namedtuple
from django.forms import TypedChoiceField
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from evap.evaluation.models import BASE_UNIPOLAR_CHOICES
from evap.rewards.tools import can_reward_points_be_used_by
from evap.student.forms import H... | 31.904494 | 148 | 0.729002 | from collections import namedtuple
from django.forms import TypedChoiceField
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from evap.evaluation.models import BASE_UNIPOLAR_CHOICES
from evap.rewards.tools import can_reward_points_be_used_by
from evap.student.forms import H... | true | true |
f74689725c645f0b236f98e65511c1fb73112082 | 4,920 | py | Python | readability/text/analyzer.py | Cong-1998/Flesch_Kincaid | 8dc695541cfd5266cbbb1d61605b5f232fb9a31d | [
"MIT"
] | null | null | null | readability/text/analyzer.py | Cong-1998/Flesch_Kincaid | 8dc695541cfd5266cbbb1d61605b5f232fb9a31d | [
"MIT"
] | null | null | null | readability/text/analyzer.py | Cong-1998/Flesch_Kincaid | 8dc695541cfd5266cbbb1d61605b5f232fb9a31d | [
"MIT"
] | null | null | null | import os
import re
from .syllables import count as count_syllables
from nltk.tokenize import sent_tokenize, TweetTokenizer
from nltk.stem.porter import PorterStemmer
class AnalyzerStatistics:
def __init__(self, stats):
self.stats = stats
@property
def num_poly_syllable_words(self):
retur... | 31.538462 | 78 | 0.618293 | import os
import re
from .syllables import count as count_syllables
from nltk.tokenize import sent_tokenize, TweetTokenizer
from nltk.stem.porter import PorterStemmer
class AnalyzerStatistics:
def __init__(self, stats):
self.stats = stats
@property
def num_poly_syllable_words(self):
retur... | true | true |
f746897b0f11c0721acb5665fae267095eb98542 | 12,900 | py | Python | google/cloud/videointelligence/v1p2beta1/videointelligence-v1p2beta1-py/google/cloud/videointelligence_v1p2beta1/services/video_intelligence_service/async_client.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | google/cloud/videointelligence/v1p2beta1/videointelligence-v1p2beta1-py/google/cloud/videointelligence_v1p2beta1/services/video_intelligence_service/async_client.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | google/cloud/videointelligence/v1p2beta1/videointelligence-v1p2beta1-py/google/cloud/videointelligence_v1p2beta1/services/video_intelligence_service/async_client.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 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... | 46.909091 | 187 | 0.677907 |
from collections import OrderedDict
import functools
import re
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources
import google.api_core.client_options as ClientOptions
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1 ... | true | true |
f74689826eaced6d71ee0d612eb56e92a8a4d186 | 23,636 | py | Python | src/twisted/protocols/memcache.py | matthew-turnaroundfactor/twisted | 62ae75dfa76de1e4db515fc6390171ba3e9160a7 | [
"MIT",
"Unlicense"
] | null | null | null | src/twisted/protocols/memcache.py | matthew-turnaroundfactor/twisted | 62ae75dfa76de1e4db515fc6390171ba3e9160a7 | [
"MIT",
"Unlicense"
] | 1 | 2019-10-02T18:56:18.000Z | 2019-10-02T18:56:18.000Z | src/twisted/protocols/memcache.py | matthew-turnaroundfactor/twisted | 62ae75dfa76de1e4db515fc6390171ba3e9160a7 | [
"MIT",
"Unlicense"
] | 1 | 2019-10-02T18:36:25.000Z | 2019-10-02T18:36:25.000Z | # -*- test-case-name: twisted.test.test_memcache -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Memcache client protocol. Memcached is a caching server, storing data in the
form of pairs key/value, and memcache is the protocol to talk with it.
To connect to a server, create a factory ... | 30.856397 | 79 | 0.582036 |
from collections import deque
from twisted.protocols.basic import LineReceiver
from twisted.protocols.policies import TimeoutMixin
from twisted.internet.defer import Deferred, fail, TimeoutError
from twisted.python import log
from twisted.python.compat import (
intToBytes, iteritems, nativeString, networkStr... | true | true |
f7468bc9c96332e6e32427dd26336d3f82ac2c16 | 951 | py | Python | example_py/example_2.py | YoshimitsuMatsutaIe/ans_2021 | a04cd9b9541583aaa8a6dc5ece323ae1cf706c3b | [
"MIT"
] | null | null | null | example_py/example_2.py | YoshimitsuMatsutaIe/ans_2021 | a04cd9b9541583aaa8a6dc5ece323ae1cf706c3b | [
"MIT"
] | null | null | null | example_py/example_2.py | YoshimitsuMatsutaIe/ans_2021 | a04cd9b9541583aaa8a6dc5ece323ae1cf706c3b | [
"MIT"
] | null | null | null | ### SciPyを使った実装 ###
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
def diff_eq(x, t, a):
"""微分方程式"""
return a * x
def do_example_2():
time_list = np.arange(0.0, 2.0, 0.01) # 時間のリスト
x_init = [1.0] # 初期値
a = 1
# 解く
sol = solve_ivp(
... | 23.195122 | 70 | 0.576236 | import solve_ivp
import matplotlib.pyplot as plt
def diff_eq(x, t, a):
return a * x
def do_example_2():
time_list = np.arange(0.0, 2.0, 0.01)
x_init = [1.0]
a = 1
sol = solve_ivp(
fun = diff_eq,
y0 = x_init,
t_span=(0.0, 2.0),
t_eval = time_list,... | true | true |
f7468cb4dc72522230b8a6894296c85bc8f6ed78 | 3,262 | py | Python | experiments/mnist/load_data.py | LLNL/XNAS | 62f90bb29b492a3b993d7a866d229634a2d95057 | [
"MIT"
] | null | null | null | experiments/mnist/load_data.py | LLNL/XNAS | 62f90bb29b492a3b993d7a866d229634a2d95057 | [
"MIT"
] | null | null | null | experiments/mnist/load_data.py | LLNL/XNAS | 62f90bb29b492a3b993d7a866d229634a2d95057 | [
"MIT"
] | 1 | 2022-03-04T23:23:31.000Z | 2022-03-04T23:23:31.000Z | """
MIT License
Copyright (c) 2022, Lawrence Livermore National Security, LLC
Written by Zachariah Carmichael et al.
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... | 32.949495 | 78 | 0.656652 | from xnas.utils import get_logger
logger = get_logger(__name__)
def preprocess(image, label):
import tensorflow as tf
mean = [0.13066044]
std = [0.3081079]
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
image = (image - tf.reshape(mean, [1, 1, 1])) / tf.reshape(std, [1, 1, 1... | true | true |
f7468d54b10e63232e7320f54dd6fbc2b1c0fd9b | 31,342 | py | Python | redwood/cli/admin/delete.py | BD2KGenomics/dcc-ops | 7a4a5fe4fa2881edecf68830224bf7db282a8fea | [
"Apache-2.0"
] | 2 | 2017-04-27T06:51:11.000Z | 2021-10-10T21:16:54.000Z | redwood/cli/admin/delete.py | BD2KGenomics/dcc-ops | 7a4a5fe4fa2881edecf68830224bf7db282a8fea | [
"Apache-2.0"
] | 143 | 2017-02-13T21:46:12.000Z | 2021-06-01T21:55:45.000Z | redwood/cli/admin/delete.py | BD2KGenomics/dcc-ops | 7a4a5fe4fa2881edecf68830224bf7db282a8fea | [
"Apache-2.0"
] | 5 | 2017-06-21T17:24:02.000Z | 2021-10-10T21:16:46.000Z | """
delete.py
This script allows developers to delete files generated from redwood storage
system.
"""
import argparse
import os
import json
import boto3
import botocore
import defaults
import docker
import logging
import urllib2
import ssl
import datetime
from io import BytesIO
logger = logging.getLogger('admin-de... | 34.747228 | 93 | 0.57616 |
import argparse
import os
import json
import boto3
import botocore
import defaults
import docker
import logging
import urllib2
import ssl
import datetime
from io import BytesIO
logger = logging.getLogger('admin-delete')
logger.setLevel(level=logging.INFO)
strmhd = logging.StreamHandler()
strmhd.setLevel(level=logging... | true | true |
f7468d703c28bb02ec43eafb8acab843db7f913f | 12,662 | py | Python | pmlb/pmlb.py | EpistasisLab/penn-ml-benchmarks | ac4ae198e62a7828cb9ff957d805bc33197dca28 | [
"MIT"
] | 540 | 2016-11-11T19:24:10.000Z | 2020-10-05T22:38:35.000Z | pmlb/pmlb.py | EpistasisLab/penn-ml-benchmarks | ac4ae198e62a7828cb9ff957d805bc33197dca28 | [
"MIT"
] | 76 | 2016-11-11T19:30:36.000Z | 2020-10-09T13:03:55.000Z | pmlb/pmlb.py | EpistasisLab/penn-ml-benchmarks | ac4ae198e62a7828cb9ff957d805bc33197dca28 | [
"MIT"
] | 92 | 2016-11-13T16:56:27.000Z | 2020-10-03T16:41:35.000Z | # -*- coding: utf-8 -*-
"""
PMLB was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- William La Cava (lacava@upenn.edu)
- Weixuan Fu (weixuanf@upenn.edu)
- and many more generous open source contributors
Permission is hereby granted, free of charge, ... | 40.453674 | 171 | 0.661981 |
import pandas as pd
import os
from .dataset_lists import (
dataset_names,
classification_dataset_names,
regression_dataset_names)
import requests
import warnings
import subprocess
import pathlib
from sklearn.neighbors import NearestNeighbors
from sklearn.preprocessing import StandardScaler
from .suppor... | true | true |
f7468db44d334e9e19584b5ea019d0c1eb7a9e16 | 5,349 | py | Python | lte/gateway/python/magma/pipelined/app/dpi.py | KenG98/magma | dac860761778371f305901e54d81fb09eff102e7 | [
"BSD-3-Clause"
] | 3 | 2019-08-16T17:03:09.000Z | 2019-08-23T21:57:48.000Z | lte/gateway/python/magma/pipelined/app/dpi.py | irsols-devops/magma | 1f01a86e0515ffeef689e863db6daa7b31a57e0b | [
"BSD-3-Clause"
] | null | null | null | lte/gateway/python/magma/pipelined/app/dpi.py | irsols-devops/magma | 1f01a86e0515ffeef689e863db6daa7b31a57e0b | [
"BSD-3-Clause"
] | null | null | null | """
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from magma.pipelined.openfl... | 40.218045 | 79 | 0.621051 |
from magma.pipelined.openflow import flows
from magma.pipelined.app.base import MagmaController
from magma.pipelined.openflow.magma_match import MagmaMatch
from magma.pipelined.openflow.registers import Direction
import shlex
import subprocess
import logging
from ryu.lib.packet import ether_types
appMap = {"faceboo... | true | true |
f7468ea9db60312428886af048c8ee5c6c571537 | 2,144 | py | Python | Project Code/encrypt.py | wtl5736/Introduction-to-Cryptography-Project | 731cabc0de4893a557d6a69fd688abf232ab633d | [
"MIT"
] | 1 | 2018-04-26T15:54:18.000Z | 2018-04-26T15:54:18.000Z | Project Code/encrypt.py | wtl5736/Introduction-to-Cryptography-Project | 731cabc0de4893a557d6a69fd688abf232ab633d | [
"MIT"
] | null | null | null | Project Code/encrypt.py | wtl5736/Introduction-to-Cryptography-Project | 731cabc0de4893a557d6a69fd688abf232ab633d | [
"MIT"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Name: encrypt.py
Author: Wesley Lee - wtl5736@rit.edu
Assignment: Introduction to Cryptography Project
Date: 04-20-2018
Description:
Encrypts a file usesing a symmetric-key algorithm based on a special class of graphs.
"""
from time import *
from getA import *
# In... | 27.487179 | 89 | 0.507929 |
from time import *
from getA import *
def encrypt_init(plaintext, password):
plaintextASCII = [ord(a) for a in plaintext]
asciiPW = [ord(b) for b in password]
A = getA(asciiPW, plaintextASCII)
L_1 = matmul(A, plaintextASCII)
newL_1 = [int(a) % 127 for a in L_1]
return newL_1, asciiPW
... | true | true |
f7468f07b2fe702711760257c1b3666620304495 | 3,851 | py | Python | SCLPsolver/tests/MCQN_test_mpc.py | haroldship/SCLPsolver | 70b79acb074f51d4a269993f6a1fcf04a8196a89 | [
"Apache-2.0"
] | 1 | 2020-08-11T16:01:55.000Z | 2020-08-11T16:01:55.000Z | SCLPsolver/tests/MCQN_test_mpc.py | haroldship/SCLPsolver | 70b79acb074f51d4a269993f6a1fcf04a8196a89 | [
"Apache-2.0"
] | null | null | null | SCLPsolver/tests/MCQN_test_mpc.py | haroldship/SCLPsolver | 70b79acb074f51d4a269993f6a1fcf04a8196a89 | [
"Apache-2.0"
] | 2 | 2020-06-29T15:23:59.000Z | 2022-02-07T08:58:40.000Z | # Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 41.408602 | 141 | 0.699299 |
import sys
import numpy as np
import os
proj = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
sys.path.append(proj)
from SCLP import SCLP, SCLP_settings
from doe.data_generators.MCQN import generate_MCQN_data
from subroutines.utils import relative_to_project
from doe.res... | true | true |
f7468f3ab7a1cbdc49079324e6479beb7d7f6893 | 6,611 | py | Python | so_pysm_models/alms.py | dennis-l/so_pysm_models | da21d51fd09ef409542862a773d22ed1656bb1bb | [
"BSD-3-Clause"
] | 4 | 2018-12-14T10:16:12.000Z | 2021-09-07T02:54:51.000Z | so_pysm_models/alms.py | dennis-l/so_pysm_models | da21d51fd09ef409542862a773d22ed1656bb1bb | [
"BSD-3-Clause"
] | 40 | 2018-12-05T21:48:09.000Z | 2021-09-29T01:03:25.000Z | so_pysm_models/alms.py | dennis-l/so_pysm_models | da21d51fd09ef409542862a773d22ed1656bb1bb | [
"BSD-3-Clause"
] | 11 | 2018-12-05T21:43:07.000Z | 2021-04-09T16:51:56.000Z | import numpy as np
import healpy as hp
try:
from pixell import curvedsky, enmap
except:
pass
try: # PySM >= 3.2.1
import pysm3.units as u
import pysm3 as pysm
except ImportError:
import pysm.units as u
import pysm
class PrecomputedAlms(object):
def __init__(
self,
filena... | 35.929348 | 102 | 0.589775 | import numpy as np
import healpy as hp
try:
from pixell import curvedsky, enmap
except:
pass
try:
import pysm3.units as u
import pysm3 as pysm
except ImportError:
import pysm.units as u
import pysm
class PrecomputedAlms(object):
def __init__(
self,
filename,
inp... | true | true |
f74690937d3082ed5549936e9637be3f849e0e07 | 798 | py | Python | analyzeData/script.py | Tiloon/Movie-processing | 6b1fc71171a39d11b37a13ecc6384c361ef4e873 | [
"MIT"
] | null | null | null | analyzeData/script.py | Tiloon/Movie-processing | 6b1fc71171a39d11b37a13ecc6384c361ef4e873 | [
"MIT"
] | null | null | null | analyzeData/script.py | Tiloon/Movie-processing | 6b1fc71171a39d11b37a13ecc6384c361ef4e873 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import sys
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
import pickle
class Payload:
def __init__(self, svm, vect):
self.svm = svm
self.vect = vect
def use(self, comm):
return self.svm.predict(self.vect.tr... | 25.741935 | 106 | 0.636591 |
import sys
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
import pickle
class Payload:
def __init__(self, svm, vect):
self.svm = svm
self.vect = vect
def use(self, comm):
return self.svm.predict(self.vect.transform(comm))
de... | true | true |
f746917be39127fc8cf775799df9be8dfb62da54 | 956 | py | Python | setup.py | jerrygb/TensorFlowOnSpark | b9cf66466ea5eee86ce498ca83e4f00fb9e9f51e | [
"Apache-2.0"
] | null | null | null | setup.py | jerrygb/TensorFlowOnSpark | b9cf66466ea5eee86ce498ca83e4f00fb9e9f51e | [
"Apache-2.0"
] | null | null | null | setup.py | jerrygb/TensorFlowOnSpark | b9cf66466ea5eee86ce498ca83e4f00fb9e9f51e | [
"Apache-2.0"
] | null | null | null | from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='tensorflowonspark',
packages=['tensorflowonspark'],
version='2.1.2',
description='Deep learning with TensorFlow on Apache Spark clusters',
long_description=long_description,
long_description_content_type='... | 32.965517 | 85 | 0.688285 | from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='tensorflowonspark',
packages=['tensorflowonspark'],
version='2.1.2',
description='Deep learning with TensorFlow on Apache Spark clusters',
long_description=long_description,
long_description_content_type='... | true | true |
f7469291496c66cdddda764e2a4ee21f12245102 | 617 | py | Python | gesund_projekt/api/views/challenges.py | asis2016/gesund-projekt | cb3828b69cd6a86deeab16943e38b6ebffd86abb | [
"MIT"
] | null | null | null | gesund_projekt/api/views/challenges.py | asis2016/gesund-projekt | cb3828b69cd6a86deeab16943e38b6ebffd86abb | [
"MIT"
] | null | null | null | gesund_projekt/api/views/challenges.py | asis2016/gesund-projekt | cb3828b69cd6a86deeab16943e38b6ebffd86abb | [
"MIT"
] | null | null | null | from rest_framework.generics import ListAPIView, RetrieveAPIView
from api.serializers import ChallengeSerializer
from challenges.models import Challenge
class ChallengeListAPIView(ListAPIView):
""" Lists all challenges. """
serializer_class = ChallengeSerializer
def get_queryset(self):
return Ch... | 29.380952 | 71 | 0.769854 | from rest_framework.generics import ListAPIView, RetrieveAPIView
from api.serializers import ChallengeSerializer
from challenges.models import Challenge
class ChallengeListAPIView(ListAPIView):
serializer_class = ChallengeSerializer
def get_queryset(self):
return Challenge.objects.all().filter(autho... | true | true |
f74692db3656e7a00909094520a016296766290e | 18,671 | py | Python | ExpFile.py | zzpwahaha/DataCrylsis | b4436435d6ead3322ce54d22e048077732e39e57 | [
"MIT"
] | null | null | null | ExpFile.py | zzpwahaha/DataCrylsis | b4436435d6ead3322ce54d22e048077732e39e57 | [
"MIT"
] | null | null | null | ExpFile.py | zzpwahaha/DataCrylsis | b4436435d6ead3322ce54d22e048077732e39e57 | [
"MIT"
] | null | null | null | # created by mark brown
import h5py as h5
from colorama import Fore, Style
from numpy import array as arr
import numpy as np
import Miscellaneous as misc
import datetime
dataAddress = None
currentVersion = 1
def annotate(fileID=None, expFile_version=currentVersion, useBaseA=True):
#hashNum = int(input("Title-Level... | 40.766376 | 172 | 0.544749 |
import h5py as h5
from colorama import Fore, Style
from numpy import array as arr
import numpy as np
import Miscellaneous as misc
import datetime
dataAddress = None
currentVersion = 1
def annotate(fileID=None, expFile_version=currentVersion, useBaseA=True):
hashNum = 3
with ExpFile(expFile_version=e... | true | true |
f7469349adc6dd5c002788ed65aeb740e8ff4310 | 8,019 | py | Python | src/core/src/tortuga/objects/kit.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 33 | 2018-03-02T17:07:39.000Z | 2021-05-21T18:02:51.000Z | src/core/src/tortuga/objects/kit.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 201 | 2018-03-05T14:28:24.000Z | 2020-11-23T19:58:27.000Z | src/core/src/tortuga/objects/kit.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 23 | 2018-03-02T17:21:59.000Z | 2020-11-18T14:52:38.000Z | # Copyright 2008-2018 Univa Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 29.373626 | 76 | 0.590223 |
from typing import Iterable, Optional
import tortuga.objects.component
import tortuga.objects.kitSource
from tortuga.objects.tortugaObject import TortugaObject, TortugaObjectList
from tortuga.utility.helper import str2bool
class Kit(TortugaObject): \
ROOT_TAG = 'kit'
def __init__(s... | true | true |
f74693b4705cab0b611ef287c46328ac6823579f | 43,678 | py | Python | sympy/sets/fancysets.py | syhqik-wafxo0-Mopgib/sympy | 551f6fe60fe6d4251a0ac76e64197f23063af261 | [
"BSD-3-Clause"
] | 1 | 2020-01-15T17:04:02.000Z | 2020-01-15T17:04:02.000Z | sympy/sets/fancysets.py | sonishreyas/sympy | fbf508919adb0064505746b58d755d3a63fe6a4d | [
"BSD-3-Clause"
] | null | null | null | sympy/sets/fancysets.py | sonishreyas/sympy | fbf508919adb0064505746b58d755d3a63fe6a4d | [
"BSD-3-Clause"
] | null | null | null | from __future__ import print_function, division
from functools import reduce
from sympy.core.basic import Basic
from sympy.core.compatibility import with_metaclass, range, PY3
from sympy.core.containers import Tuple
from sympy.core.expr import Expr
from sympy.core.function import Lambda
from sympy.core.logic import f... | 30.802539 | 121 | 0.540684 | from __future__ import print_function, division
from functools import reduce
from sympy.core.basic import Basic
from sympy.core.compatibility import with_metaclass, range, PY3
from sympy.core.containers import Tuple
from sympy.core.expr import Expr
from sympy.core.function import Lambda
from sympy.core.logic import f... | true | true |
f74693e790102986f5ea81176f949a0675c8ab3e | 4,448 | py | Python | tests/test_one_hot_encode.py | yotammarton/TransformDF2Numpy | 3528fe2f207089186865290b9f5cbd14d91e8c82 | [
"MIT"
] | null | null | null | tests/test_one_hot_encode.py | yotammarton/TransformDF2Numpy | 3528fe2f207089186865290b9f5cbd14d91e8c82 | [
"MIT"
] | null | null | null | tests/test_one_hot_encode.py | yotammarton/TransformDF2Numpy | 3528fe2f207089186865290b9f5cbd14d91e8c82 | [
"MIT"
] | null | null | null | import unittest
import numpy as np
import pandas as pd
import df2numpy
from df2numpy import TransformDF2Numpy, one_hot_encode, NAN_CATEGORY, DROPPED_CATEGORY
from df2numpy.errors import *
df = pd.DataFrame({
"A": ["Aa", "Ab", "Ac", "Aa", "Ac", "Aa", "Aa", "Aa"], # uniques: 3, to_be_thresholded: "Ab"
"B": [1.... | 28.883117 | 112 | 0.480216 | import unittest
import numpy as np
import pandas as pd
import df2numpy
from df2numpy import TransformDF2Numpy, one_hot_encode, NAN_CATEGORY, DROPPED_CATEGORY
from df2numpy.errors import *
df = pd.DataFrame({
"A": ["Aa", "Ab", "Ac", "Aa", "Ac", "Aa", "Aa", "Aa"],
"B": [1., -3., 0., 2, 3, 0, -1.3, 0.192],
... | true | true |
f74694212f5afafd8daa98c7657a36bf1fec0d47 | 3,924 | py | Python | utils/embeds.py | davisschenk/Unnamed-Bot | 8e05d5a79dfab768574efd4e9061e2d7b22ae9e5 | [
"MIT"
] | null | null | null | utils/embeds.py | davisschenk/Unnamed-Bot | 8e05d5a79dfab768574efd4e9061e2d7b22ae9e5 | [
"MIT"
] | null | null | null | utils/embeds.py | davisschenk/Unnamed-Bot | 8e05d5a79dfab768574efd4e9061e2d7b22ae9e5 | [
"MIT"
] | null | null | null | import discord
from discord.embeds import EmptyEmbed
class CustomEmbeds:
confirm_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/ConfirmIcon.png?token=AIRYAKQHGVMHHBQ73J7G2AK5FKHRK'
add_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/AddIcon.png?t... | 44.590909 | 167 | 0.677115 | import discord
from discord.embeds import EmptyEmbed
class CustomEmbeds:
confirm_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/ConfirmIcon.png?token=AIRYAKQHGVMHHBQ73J7G2AK5FKHRK'
add_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/AddIcon.png?t... | true | true |
f74696a866a868795fea76bc8bb1d2e85bde8357 | 7,991 | py | Python | setup.py | G705-Ghilan/HackerMode | 6e799333fe6479a26c1f403eba318ae857a45cb6 | [
"MIT"
] | null | null | null | setup.py | G705-Ghilan/HackerMode | 6e799333fe6479a26c1f403eba318ae857a45cb6 | [
"MIT"
] | null | null | null | setup.py | G705-Ghilan/HackerMode | 6e799333fe6479a26c1f403eba318ae857a45cb6 | [
"MIT"
] | null | null | null | import os
import json
import shutil
from lib.config import Config
from lib.variables import Variables, HACKERMODE_FOLDER_NAME
RED = '\033[1;31m'
GREEN = '\033[1;32m'
YELLOW = '\033[1;33m'
NORMAL = '\033[0m'
UNDERLINE = '\033[4m'
BOLD = '\033[1m'
with open(os.path.join(Variables.HACKERMODE_PATH, 'packages.json')) as... | 40.563452 | 149 | 0.564385 | import os
import json
import shutil
from lib.config import Config
from lib.variables import Variables, HACKERMODE_FOLDER_NAME
RED = '\033[1;31m'
GREEN = '\033[1;32m'
YELLOW = '\033[1;33m'
NORMAL = '\033[0m'
UNDERLINE = '\033[4m'
BOLD = '\033[1m'
with open(os.path.join(Variables.HACKERMODE_PATH, 'packages.json')) as... | true | true |
f74697b2e0fa77c16292d4dd0a67ff3f31325bb3 | 15,819 | py | Python | validate.py | chrisjuniorli/pytorch-image-models | bb815fa90c46b1f5f2f59a0dcddab8ce69f91dcf | [
"Apache-2.0"
] | null | null | null | validate.py | chrisjuniorli/pytorch-image-models | bb815fa90c46b1f5f2f59a0dcddab8ce69f91dcf | [
"Apache-2.0"
] | null | null | null | validate.py | chrisjuniorli/pytorch-image-models | bb815fa90c46b1f5f2f59a0dcddab8ce69f91dcf | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... | 44.560563 | 187 | 0.62899 |
import argparse
import os
import csv
import glob
import time
import logging
import torch
import torch.nn as nn
import torch.nn.parallel
from collections import OrderedDict
from contextlib import suppress
from timm.models import create_model, apply_test_time_pool, load_checkpoint, is_model, list_models
from timm.data ... | true | true |
f74698cbc4678bb1c82b5cb67a32560f192fe9f5 | 28,378 | py | Python | pymc3/step_methods/metropolis.py | mcnoat/pymc3 | 8b1f64cce32db3357301b88bbe9f7108733ac70a | [
"Apache-2.0"
] | 1 | 2020-12-10T12:05:25.000Z | 2020-12-10T12:05:25.000Z | pymc3/step_methods/metropolis.py | mcnoat/pymc3 | 8b1f64cce32db3357301b88bbe9f7108733ac70a | [
"Apache-2.0"
] | 2 | 2019-12-30T17:58:29.000Z | 2020-01-01T23:23:39.000Z | pymc3/step_methods/metropolis.py | mcnoat/pymc3 | 8b1f64cce32db3357301b88bbe9f7108733ac70a | [
"Apache-2.0"
] | 1 | 2019-12-30T16:21:43.000Z | 2019-12-30T16:21:43.000Z | # Copyright 2020 The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 31.778275 | 101 | 0.603778 |
import numpy as np
import numpy.random as nr
import scipy.linalg
import theano
import pymc3 as pm
from pymc3.distributions import draw_values
from pymc3.step_methods.arraystep import (
ArrayStep,
ArrayStepShared,
Competence,
PopulationArrayStepShared,
metrop_select,
)
from pymc3.thea... | true | true |
f746996b9fef1ed3ea638b564861edcaa1379a63 | 4,788 | py | Python | entities/items.py | TwoBlueCats/wandering-shadows | 8962134d2a046e017b8c49b2d67a4f98e67f1d33 | [
"MIT"
] | null | null | null | entities/items.py | TwoBlueCats/wandering-shadows | 8962134d2a046e017b8c49b2d67a4f98e67f1d33 | [
"MIT"
] | null | null | null | entities/items.py | TwoBlueCats/wandering-shadows | 8962134d2a046e017b8c49b2d67a4f98e67f1d33 | [
"MIT"
] | null | null | null | from combat import Damage, DamageType
from components import consumable, effects
from components_types import ConsumableTarget as Target, ConsumableType
from entities.factory import ItemFactory
from ranged_value import Range
def effect_level_up(effect: effects.Effect, floor: int, base: int):
match effect:
... | 29.73913 | 100 | 0.645781 | from combat import Damage, DamageType
from components import consumable, effects
from components_types import ConsumableTarget as Target, ConsumableType
from entities.factory import ItemFactory
from ranged_value import Range
def effect_level_up(effect: effects.Effect, floor: int, base: int):
match effect:
... | true | true |
f7469ab5ddca5ea20407691b007c3a589bf3b9c8 | 12,812 | py | Python | src/pip/_internal/vcs/git.py | DiegoCaraballo/pip | 4b6bb5da37c182acd509c85f72840ca37108cf65 | [
"MIT"
] | 1 | 2021-02-13T22:40:04.000Z | 2021-02-13T22:40:04.000Z | src/pip/_internal/vcs/git.py | DiegoCaraballo/pip | 4b6bb5da37c182acd509c85f72840ca37108cf65 | [
"MIT"
] | null | null | null | src/pip/_internal/vcs/git.py | DiegoCaraballo/pip | 4b6bb5da37c182acd509c85f72840ca37108cf65 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import logging
import os.path
import re
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._internal.exceptions import BadCom... | 35.688022 | 79 | 0.581408 | from __future__ import absolute_import
import logging
import os.path
import re
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._internal.exceptions import BadCom... | true | true |
f7469e02efdd16b0ca1a97732c6a2a74edf69850 | 13,900 | py | Python | src/main.py | wodxyj/plpp | cd74916536cf180a37b088ec61ea2a12a63719f2 | [
"MIT"
] | null | null | null | src/main.py | wodxyj/plpp | cd74916536cf180a37b088ec61ea2a12a63719f2 | [
"MIT"
] | null | null | null | src/main.py | wodxyj/plpp | cd74916536cf180a37b088ec61ea2a12a63719f2 | [
"MIT"
] | null | null | null | import os
import shutil
import time
import configargparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from tensorboardX import SummaryWriter
from torch.optim.lr_scheduler import MultiStepLR
from tqdm ... | 44.126984 | 120 | 0.644964 | import os
import shutil
import time
import configargparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from tensorboardX import SummaryWriter
from torch.optim.lr_scheduler import MultiStepLR
from tqdm ... | true | true |
f7469e54f61a1f5f1ce6bd3f9cb80c15814e0247 | 6,616 | py | Python | mmt/models/resnet.py | wangyuan249/Mymmt767 | 6b9bb566d290bd3157350f6496fcb5df8c2b515c | [
"MIT"
] | null | null | null | mmt/models/resnet.py | wangyuan249/Mymmt767 | 6b9bb566d290bd3157350f6496fcb5df8c2b515c | [
"MIT"
] | null | null | null | mmt/models/resnet.py | wangyuan249/Mymmt767 | 6b9bb566d290bd3157350f6496fcb5df8c2b515c | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
import pdb
from .layers import (
SpatialAttention2d,
WeightedSum2d)
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resn... | 36.153005 | 98 | 0.578446 | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
import pdb
from .layers import (
SpatialAttention2d,
WeightedSum2d)
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resn... | true | true |
f7469ea3c6d22a9802b77bd70fe053c2c256c38f | 949 | py | Python | setup.py | dontbanmeplz/image-to-ascii | d7191b349f68cfce8ff9688847797a3eed79e064 | [
"MIT"
] | 8 | 2021-03-03T15:40:34.000Z | 2021-09-18T22:28:47.000Z | setup.py | dontbanmeplz/image-to-ascii | d7191b349f68cfce8ff9688847797a3eed79e064 | [
"MIT"
] | null | null | null | setup.py | dontbanmeplz/image-to-ascii | d7191b349f68cfce8ff9688847797a3eed79e064 | [
"MIT"
] | 3 | 2021-03-04T15:06:39.000Z | 2021-08-19T03:19:28.000Z |
from distutils.core import setup
setup(
name = 'image_to_ascii',
packages = ['image_to_ascii'],
version = '0.2',
license='MIT',
description = 'A simple python library to convert images to ASCII art',
long_description="README.md",
author = 'Aypro',
author_email = 'ayprogaming1@gmail.com',
... | 32.724138 | 85 | 0.630137 |
from distutils.core import setup
setup(
name = 'image_to_ascii',
packages = ['image_to_ascii'],
version = '0.2',
license='MIT',
description = 'A simple python library to convert images to ASCII art',
long_description="README.md",
author = 'Aypro',
author_email = 'ayprogaming1@gmail.com',
... | true | true |
f7469f145e0d8dbca9cae5631dcc71882595efbd | 364 | py | Python | Exercicios-Python/exercicios-curso-em-video/d035.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | Exercicios-Python/exercicios-curso-em-video/d035.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | Exercicios-Python/exercicios-curso-em-video/d035.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | print('-='*20)
print('Analisador de Triângulos')
print('-='*20)
r1 = float(input('Primeiro segmento: '))
r2 = float(input('Segundo segmento: '))
r3 = float(input('Terceiro segmento: '))
if r1 < r2 + r3 and r3 < r2 + r1 and r2 < r1 + r3 :
print('Os segmentos acima, PODEM FORMAR triângulos!')
else:
print('Os segm... | 33.090909 | 61 | 0.662088 | print('-='*20)
print('Analisador de Triângulos')
print('-='*20)
r1 = float(input('Primeiro segmento: '))
r2 = float(input('Segundo segmento: '))
r3 = float(input('Terceiro segmento: '))
if r1 < r2 + r3 and r3 < r2 + r1 and r2 < r1 + r3 :
print('Os segmentos acima, PODEM FORMAR triângulos!')
else:
print('Os segm... | true | true |
f7469f5ca3132fdfca4ebbd47da2aa7673db3622 | 5,283 | py | Python | ros/src/twist_controller/dbw_node.py | djiglesias/CarND-Capstone | 45e8ca022b08ab3625d49533976bdecc5f909f8c | [
"MIT"
] | 1 | 2018-08-17T13:57:44.000Z | 2018-08-17T13:57:44.000Z | ros/src/twist_controller/dbw_node.py | djiglesias/CarND-Capstone | 45e8ca022b08ab3625d49533976bdecc5f909f8c | [
"MIT"
] | null | null | null | ros/src/twist_controller/dbw_node.py | djiglesias/CarND-Capstone | 45e8ca022b08ab3625d49533976bdecc5f909f8c | [
"MIT"
] | 5 | 2018-08-18T11:47:54.000Z | 2018-09-25T20:02:45.000Z | #!/usr/bin/env python
import rospy
from std_msgs.msg import Bool
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller import Controller
'''
You can build this node only after you have built (or partially built) th... | 40.022727 | 101 | 0.619345 |
import rospy
from std_msgs.msg import Bool
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller import Controller
class DBWNode(object):
def __init__(self):
rospy.init_node('dbw_node')
... | true | true |
f7469fb8a042bc51c1b58abd3e3454c5eedc909d | 8,377 | py | Python | shmup_detect/fhog.py | KyGao/pygame_tracker | c1c4cc4a74c478e6655aa02aa4950d2ab97f6eae | [
"MIT"
] | 1 | 2021-05-22T05:08:19.000Z | 2021-05-22T05:08:19.000Z | shmup_detect/fhog.py | KyGao/pygame-tracker | c1c4cc4a74c478e6655aa02aa4950d2ab97f6eae | [
"MIT"
] | null | null | null | shmup_detect/fhog.py | KyGao/pygame-tracker | c1c4cc4a74c478e6655aa02aa4950d2ab97f6eae | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*
import numpy as np
import cv2
from numba import njit
import time
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@njit
def func1(dx, dy, boundary_x, boundary_y, height, width, numChannels):
r = np.zeros((height, width), dtype=np.float32)
alfa = np.zeros((height, width, 2), np.int32)
for j in... | 36.107759 | 157 | 0.523576 |
import numpy as np
import cv2
from numba import njit
import time
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@njit
def func1(dx, dy, boundary_x, boundary_y, height, width, numChannels):
r = np.zeros((height, width), dtype=np.float32)
alfa = np.zeros((height, width, 2), np.int32)
for j in range(1, height-1):
... | true | true |
f7469fed2a07c002413bc00809fce9038ea48e4e | 3,366 | py | Python | COLREGsBasedRiskDomain/RiskSubjection.py | wylloong/TDMOA-USV | 3a8690559f6df76f0ed457a89dcec2ec268db34f | [
"MIT"
] | 10 | 2020-12-04T02:28:11.000Z | 2022-02-15T14:04:22.000Z | COLREGsBasedRiskDomain/RiskSubjection.py | wylloong/TDMOA-USV | 3a8690559f6df76f0ed457a89dcec2ec268db34f | [
"MIT"
] | null | null | null | COLREGsBasedRiskDomain/RiskSubjection.py | wylloong/TDMOA-USV | 3a8690559f6df76f0ed457a89dcec2ec268db34f | [
"MIT"
] | 2 | 2020-11-21T18:20:02.000Z | 2021-05-29T08:18:21.000Z | # -*- coding: utf-8 -*-
import math
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import GeoCommonBase as CoordinateBase
# 危险隶属度函数,障碍物周围隶属度函数随着方向和速度逐渐变小
# 改进:隶属度范围和速度大小有关
def riskSubjection(boatPnt,currPnt,boatVelo,boatOrien,evaluTime,impactFactor):
#考虑... | 37.4 | 161 | 0.687463 |
import math
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import GeoCommonBase as CoordinateBase
def riskSubjection(boatPnt,currPnt,boatVelo,boatOrien,evaluTime,impactFactor):
evaluDistance=boatVelo*evaluTime
realDistance=CoordinateBase.D... | true | true |
f746a00e88d506f9017cf3aaab378ebccb96a50d | 8,847 | py | Python | intersight/model/niatelemetry_syslog_remote_dest_list_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 5 | 2021-12-16T15:13:32.000Z | 2022-03-29T16:09:54.000Z | intersight/model/niatelemetry_syslog_remote_dest_list_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 4 | 2022-01-25T19:05:51.000Z | 2022-03-29T20:18:37.000Z | intersight/model/niatelemetry_syslog_remote_dest_list_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 2 | 2020-07-07T15:01:08.000Z | 2022-01-31T04:27:35.000Z | """
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | 50.267045 | 1,678 | 0.644399 |
import re
import sys
from intersight.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
)
def la... | true | true |
f746a1973297f706a0e5c6fe9b63241697ed8358 | 11,567 | py | Python | workspace_tools/toolchains/gcc.py | heldercs/ProjectMbed | c41ed5352face550df4bf5bed89672e1955d6599 | [
"Apache-2.0"
] | null | null | null | workspace_tools/toolchains/gcc.py | heldercs/ProjectMbed | c41ed5352face550df4bf5bed89672e1955d6599 | [
"Apache-2.0"
] | null | null | null | workspace_tools/toolchains/gcc.py | heldercs/ProjectMbed | c41ed5352face550df4bf5bed89672e1955d6599 | [
"Apache-2.0"
] | null | null | null | """
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | 43.980989 | 241 | 0.594882 | import re
from os.path import join, basename, splitext
from workspace_tools.toolchains import mbedToolchain
from workspace_tools.settings import GCC_ARM_PATH, GCC_CR_PATH, GCC_CS_PATH, CW_EWL_PATH, CW_GCC_PATH
from workspace_tools.settings import GOANNA_PATH
from workspace_tools.hooks import hook_tool
class GCC(mbedT... | true | true |
f746a29c9b3ff34c4e3afd3122d2d172bb4e1948 | 6,531 | py | Python | test_libs/pyspec/eth2spec/utils/ssz/test_ssz_typing.py | prestonvanloon/eth2.0-specs | a63de3dc374148fe8adacd8718f67f8c7ba54f2e | [
"CC0-1.0"
] | null | null | null | test_libs/pyspec/eth2spec/utils/ssz/test_ssz_typing.py | prestonvanloon/eth2.0-specs | a63de3dc374148fe8adacd8718f67f8c7ba54f2e | [
"CC0-1.0"
] | null | null | null | test_libs/pyspec/eth2spec/utils/ssz/test_ssz_typing.py | prestonvanloon/eth2.0-specs | a63de3dc374148fe8adacd8718f67f8c7ba54f2e | [
"CC0-1.0"
] | 1 | 2021-08-15T03:06:19.000Z | 2021-08-15T03:06:19.000Z | from .ssz_typing import (
SSZValue, SSZType, BasicValue, BasicType, Series, ElementsType,
Elements, bit, boolean, Container, List, Vector, Bytes, BytesN,
byte, uint, uint8, uint16, uint32, uint64, uint128, uint256,
Bytes32, Bytes48
)
def expect_value_error(fn, msg):
try:
fn()
raise... | 27.910256 | 108 | 0.608636 | from .ssz_typing import (
SSZValue, SSZType, BasicValue, BasicType, Series, ElementsType,
Elements, bit, boolean, Container, List, Vector, Bytes, BytesN,
byte, uint, uint8, uint16, uint32, uint64, uint128, uint256,
Bytes32, Bytes48
)
def expect_value_error(fn, msg):
try:
fn()
raise... | true | true |
f746a33e67fa17c611e9ebd340b3d36dae158aa9 | 2,368 | py | Python | src/main/python/reldata/vocab/vocab_element.py | phohenecker/rel-data | 1664336442aaadd0828a275c5b6e13284b6da824 | [
"BSD-2-Clause"
] | 1 | 2020-03-01T22:48:17.000Z | 2020-03-01T22:48:17.000Z | src/main/python/reldata/vocab/vocab_element.py | phohenecker/rel-data | 1664336442aaadd0828a275c5b6e13284b6da824 | [
"BSD-2-Clause"
] | 1 | 2020-03-03T03:23:45.000Z | 2020-03-03T23:23:42.000Z | src/main/python/reldata/vocab/vocab_element.py | phohenecker/rel-data | 1664336442aaadd0828a275c5b6e13284b6da824 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import abc
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2017, Patrick Hohenecker\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that th... | 42.285714 | 114 | 0.67652 |
import abc
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2017, Patrick Hohenecker\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that the following conditions ... | true | true |
f746a39d24d65982089e7e3a38c2972fadbe2fb2 | 1,482 | py | Python | tasks.py | tejesh95/cautious-octo-goggles | 772f2049c4e59d830ffc01463b3afce3f97c769a | [
"Apache-2.0"
] | null | null | null | tasks.py | tejesh95/cautious-octo-goggles | 772f2049c4e59d830ffc01463b3afce3f97c769a | [
"Apache-2.0"
] | null | null | null | tasks.py | tejesh95/cautious-octo-goggles | 772f2049c4e59d830ffc01463b3afce3f97c769a | [
"Apache-2.0"
] | null | null | null | # dependencies
# pydrive
# redis
# celery
import urllib2
import csv
import json
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from celery import Celery
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from celery.task.schedules import crontab
app = ... | 26 | 101 | 0.659919 |
import urllib2
import csv
import json
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from celery import Celery
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from celery.task.schedules import crontab
app = Celery('tasks', broker='redis://localh... | true | true |
f746a58bed77b6892283a87b31b1998d87dfe51f | 100 | py | Python | kbdtest/__init__.py | Ruunyox/kbdtest | b7c38907cb1ea4e89a7d746d7ea93e34278dbc66 | [
"MIT"
] | 12 | 2021-08-15T04:38:25.000Z | 2021-08-16T18:17:25.000Z | kbdtest/__init__.py | Ruunyox/kbdtest | b7c38907cb1ea4e89a7d746d7ea93e34278dbc66 | [
"MIT"
] | null | null | null | kbdtest/__init__.py | Ruunyox/kbdtest | b7c38907cb1ea4e89a7d746d7ea93e34278dbc66 | [
"MIT"
] | 2 | 2021-08-15T09:29:43.000Z | 2021-11-17T05:41:41.000Z | from .tui import curses_init, term_resize, KeyboardDisplay
from .interface import KeyboardInterface
| 33.333333 | 58 | 0.86 | from .tui import curses_init, term_resize, KeyboardDisplay
from .interface import KeyboardInterface
| true | true |
f746a5dff2265c60ade5e2428ea240bbd6464f69 | 9,795 | py | Python | projects/bootloader/scripts/can_datagram.py | Citrusboa/firmware_xiv | 4379cefae900fd67bd14d930da6b8acfce625176 | [
"MIT"
] | null | null | null | projects/bootloader/scripts/can_datagram.py | Citrusboa/firmware_xiv | 4379cefae900fd67bd14d930da6b8acfce625176 | [
"MIT"
] | null | null | null | projects/bootloader/scripts/can_datagram.py | Citrusboa/firmware_xiv | 4379cefae900fd67bd14d930da6b8acfce625176 | [
"MIT"
] | null | null | null | # pylint: skip-file
"""This client script handles datagram protocol communication between devices on the CAN."""
import zlib
import can
DEFAULT_CHANNEL = "can0"
PROT_VER = 1
CAN_BITRATE = 500000
MESSAGE_SIZE = 8
HEADER_SIZE = 6
MIN_BYTEARRAY_SIZE = 9
DATA_SIZE_SIZE = 2
PROTOCOL_VERSION_OFFSET = 0
CRC_32_OFFSET = 1
... | 34.611307 | 100 | 0.629199 |
import zlib
import can
DEFAULT_CHANNEL = "can0"
PROT_VER = 1
CAN_BITRATE = 500000
MESSAGE_SIZE = 8
HEADER_SIZE = 6
MIN_BYTEARRAY_SIZE = 9
DATA_SIZE_SIZE = 2
PROTOCOL_VERSION_OFFSET = 0
CRC_32_OFFSET = 1
DATAGRAM_TYPE_OFFSET = 5
NUM_NODE_ID_OFFSET = 6
NODE_ID_OFFSET = 7
CAN_START_ARBITRATION_ID = 0b00000010000
CAN... | true | true |
f746a68f81c96e38ad9eb71b5b3294a844532d58 | 2,845 | py | Python | services/datalad/datalad_service/handlers/snapshots.py | build3/openneuro | ae8f6edbab243703b38cefd729629c1741eb3839 | [
"MIT"
] | null | null | null | services/datalad/datalad_service/handlers/snapshots.py | build3/openneuro | ae8f6edbab243703b38cefd729629c1741eb3839 | [
"MIT"
] | null | null | null | services/datalad/datalad_service/handlers/snapshots.py | build3/openneuro | ae8f6edbab243703b38cefd729629c1741eb3839 | [
"MIT"
] | null | null | null | import os
import logging
import gevent
import falcon
from datalad_service.tasks.dataset import create_snapshot
from datalad_service.tasks.snapshots import get_snapshot, get_snapshots
from datalad_service.tasks.files import get_files
from datalad_service.tasks.publish import publish_snapshot, monitor_remote_configs
fr... | 36.012658 | 85 | 0.60703 | import os
import logging
import gevent
import falcon
from datalad_service.tasks.dataset import create_snapshot
from datalad_service.tasks.snapshots import get_snapshot, get_snapshots
from datalad_service.tasks.files import get_files
from datalad_service.tasks.publish import publish_snapshot, monitor_remote_configs
fr... | true | true |
f746a7c2a7ee6b3e6b99232fb4da444e2efb80bd | 7,229 | py | Python | train_model_LSTM.py | nchlis/image_captioning | e1ac6ae9ed9b398417a91563f1cfe316705c8e58 | [
"MIT"
] | 4 | 2019-07-07T12:19:53.000Z | 2020-09-10T13:42:49.000Z | train_model_LSTM.py | nchlis/image_captioning | e1ac6ae9ed9b398417a91563f1cfe316705c8e58 | [
"MIT"
] | 1 | 2019-05-26T18:47:27.000Z | 2019-05-27T11:55:00.000Z | train_model_LSTM.py | nchlis/image_captioning | e1ac6ae9ed9b398417a91563f1cfe316705c8e58 | [
"MIT"
] | 1 | 2021-12-24T06:34:52.000Z | 2021-12-24T06:34:52.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 3 19:22:59 2018
@author: nikos
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.io import loadmat
from skimage.transform import rescale, resize, downscale_local_mean
from lmfit.models import GaussianM... | 34.42381 | 111 | 0.720017 |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.io import loadmat
from skimage.transform import rescale, resize, downscale_local_mean
from lmfit.models import GaussianModel, ConstantModel
from keras.preprocessing import image
from keras.applications.resnet50 import prepro... | true | true |
f746a7defc1bfce38920e696c7413563e497ec45 | 4,314 | py | Python | tests/core/indexes/test_base.py | cda-group/baloo | 0d442117c2a919b177e0a96024cbdc82762cb646 | [
"BSD-3-Clause"
] | 11 | 2018-12-16T00:19:39.000Z | 2021-01-06T04:56:02.000Z | tests/core/indexes/test_base.py | monner/baloo | f6e05e35b73a75e8a300754c6bdc575e5f2d53b9 | [
"BSD-3-Clause"
] | 6 | 2019-02-21T23:22:14.000Z | 2021-06-01T22:39:32.000Z | tests/core/indexes/test_base.py | monner/baloo | f6e05e35b73a75e8a300754c6bdc575e5f2d53b9 | [
"BSD-3-Clause"
] | 6 | 2019-02-12T14:30:43.000Z | 2020-03-15T17:17:56.000Z | import numpy as np
import pytest
from baloo import Index
def assert_index_equal(actual, expected, sort=False):
actual = actual.evaluate()
expected = expected.evaluate()
actual_values = actual.values
expected_values = expected.values
if sort:
actual_values = np.sort(actual_values)
... | 31.035971 | 80 | 0.617524 | import numpy as np
import pytest
from baloo import Index
def assert_index_equal(actual, expected, sort=False):
actual = actual.evaluate()
expected = expected.evaluate()
actual_values = actual.values
expected_values = expected.values
if sort:
actual_values = np.sort(actual_values)
... | true | true |
f746a8aa2279c04ae74e6d5c98d5a44598f6003d | 7,705 | py | Python | wnet/utils/soft_n_cut_loss.py | EdgarLefevre/wnet_pytorch | ba8fa5465f72351f349c18fe7df20a60a7c7f3c5 | [
"MIT"
] | 1 | 2022-01-07T12:38:40.000Z | 2022-01-07T12:38:40.000Z | wnet/utils/soft_n_cut_loss.py | EdgarLefevre/wnet_pytorch | ba8fa5465f72351f349c18fe7df20a60a7c7f3c5 | [
"MIT"
] | null | null | null | wnet/utils/soft_n_cut_loss.py | EdgarLefevre/wnet_pytorch | ba8fa5465f72351f349c18fe7df20a60a7c7f3c5 | [
"MIT"
] | 1 | 2021-12-13T09:49:26.000Z | 2021-12-13T09:49:26.000Z | # Some methods in this file ported to Pytorch from https://github.com/Ashish77IITM/W-Net/
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import norm
from torch import Tensor
# The weight matrix w is a measure of the weight between each pixel and
# every other pi... | 37.769608 | 116 | 0.656846 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import norm
from torch import Tensor
def soft_n_cut_loss(inputs, segmentations):
loss = 0
for i in range(inputs.shape[0]):
flatten_image = torch.mean(inputs[i], dim=0)
flatten... | true | true |
f746a98f1c3278abc5805860dcccef5f56f5c3d2 | 10,265 | py | Python | quad.py | LCOGT/image_align | 12ddfb924301039a3cba5007106f6f8ff27f925e | [
"MIT"
] | null | null | null | quad.py | LCOGT/image_align | 12ddfb924301039a3cba5007106f6f8ff27f925e | [
"MIT"
] | null | null | null | quad.py | LCOGT/image_align | 12ddfb924301039a3cba5007106f6f8ff27f925e | [
"MIT"
] | null | null | null | import numpy as np
import os
from astropy.io import fits
import operator
import itertools
class ImgCat:
"""
Represent an individual image and its associated catalog, starlist, quads etc.
"""
def __init__(self, filepath, hdu=0, cat=None):
"""
:param filepath: Path to the FITS file, or ... | 32.178683 | 158 | 0.553142 | import numpy as np
import os
from astropy.io import fits
import operator
import itertools
class ImgCat:
def __init__(self, filepath, hdu=0, cat=None):
self.filepath = filepath
(imgdir, filename) = os.path.split(filepath)
(common, ext) = os.path.splitext(filename)
self.name = commo... | true | true |
f746ab401b1336506d00403cc0ce7f323fabbffa | 22,274 | py | Python | src/olympia/promoted/tests/test_admin.py | dbxnr/addons-server | bb3e2807009de36cacd5a36692e4603ba900fbd0 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/promoted/tests/test_admin.py | dbxnr/addons-server | bb3e2807009de36cacd5a36692e4603ba900fbd0 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/promoted/tests/test_admin.py | dbxnr/addons-server | bb3e2807009de36cacd5a36692e4603ba900fbd0 | [
"BSD-3-Clause"
] | null | null | null | from olympia import amo
from olympia.amo.tests import addon_factory, TestCase, user_factory, version_factory
from olympia.amo.tests.test_helpers import get_uploaded_file
from olympia.amo.urlresolvers import django_reverse, reverse
from olympia.constants.promoted import (
LINE,
RECOMMENDED,
VERIFIED,
NOT... | 40.794872 | 88 | 0.602317 | from olympia import amo
from olympia.amo.tests import addon_factory, TestCase, user_factory, version_factory
from olympia.amo.tests.test_helpers import get_uploaded_file
from olympia.amo.urlresolvers import django_reverse, reverse
from olympia.constants.promoted import (
LINE,
RECOMMENDED,
VERIFIED,
NOT... | true | true |
f746acc4b73b98e3456a6bd16a84e8c6d5bb60d8 | 7,850 | py | Python | authors/apps/articles/tests/test_articles.py | andela-gad/Ah-backend-aquaman | 29cf560063171c2bb8c8aed1ff36436acbc47bc9 | [
"BSD-3-Clause"
] | 3 | 2021-02-20T15:21:33.000Z | 2021-08-20T10:23:08.000Z | authors/apps/articles/tests/test_articles.py | andela-gad/Ah-backend-aquaman | 29cf560063171c2bb8c8aed1ff36436acbc47bc9 | [
"BSD-3-Clause"
] | 130 | 2019-11-07T02:35:18.000Z | 2021-07-30T02:17:11.000Z | authors/apps/articles/tests/test_articles.py | CryceTruly/Ah-backend-aquaman | 29cf560063171c2bb8c8aed1ff36436acbc47bc9 | [
"BSD-3-Clause"
] | 6 | 2019-06-29T12:09:37.000Z | 2020-03-06T07:02:55.000Z | from django.urls import reverse
from rest_framework import status
from authors.apps.articles.tests.base_class import ArticlesBaseTest
from .test_data import valid_article
from ..models import Article
class TestArticle(ArticlesBaseTest):
def test_create_article(self):
"""
Tests method tests wethe... | 43.611111 | 77 | 0.623312 | from django.urls import reverse
from rest_framework import status
from authors.apps.articles.tests.base_class import ArticlesBaseTest
from .test_data import valid_article
from ..models import Article
class TestArticle(ArticlesBaseTest):
def test_create_article(self):
self.register_and_login_user()
... | true | true |
f746ace8c83efa32579defc563f0a90dd5f92b48 | 628 | py | Python | pip_services_runtime/ITiming.py | pip-services-archive/pip-services-runtime-python | 70eca1ffc44bfdc45c9c65b0ee347fa578368849 | [
"MIT"
] | null | null | null | pip_services_runtime/ITiming.py | pip-services-archive/pip-services-runtime-python | 70eca1ffc44bfdc45c9c65b0ee347fa578368849 | [
"MIT"
] | null | null | null | pip_services_runtime/ITiming.py | pip-services-archive/pip-services-runtime-python | 70eca1ffc44bfdc45c9c65b0ee347fa578368849 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
pip_services_runtime.ITiming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Callback interface to complete measuring time interval.
:copyright: Digital Living Software Corp. 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
class ITimi... | 25.12 | 86 | 0.609873 |
class ITiming(object):
def end_timing(self):
pass
| true | true |
f746acf3c9158c5cbd57c4ca61100529f745282a | 33,552 | py | Python | src/sage/coding/linear_rank_metric.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | 10 | 2018-06-01T21:54:53.000Z | 2022-03-14T20:11:34.000Z | src/sage/coding/linear_rank_metric.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | 2 | 2021-04-02T20:43:29.000Z | 2021-04-05T23:38:58.000Z | src/sage/coding/linear_rank_metric.py | dimpase/sage | 468f23815ade42a2192b0a9cd378de8fdc594dcd | [
"BSL-1.0"
] | 15 | 2020-07-23T10:46:25.000Z | 2022-01-25T15:37:24.000Z | # -*- coding: utf-8 -*-
r"""
Generic structures for linear codes over the rank metric
Rank Metric
===========
In coding theory, the most common metric is the Hamming metric, where distance
between two codewords is given by the number of positions in which they differ.
An alternative to this is the rank metric. Take ... | 37.488268 | 168 | 0.601007 |
from sage.categories.fields import Fields
from sage.matrix.constructor import Matrix
from sage.structure.element import is_Matrix, is_Vector
from sage.modules.free_module_element import vector
from sage.rings.infinity import Infinity
from .linear_code_no_metric import AbstractLinearCodeNoMetric
from .linea... | true | true |
f746ad518d87bc50f0bff843098fcc894f200838 | 3,344 | py | Python | settings.py | chiriiKipkirui/djangoSite | 6ab9c463316ba40a8949a3799355d7b94f5fe6c6 | [
"MIT"
] | null | null | null | settings.py | chiriiKipkirui/djangoSite | 6ab9c463316ba40a8949a3799355d7b94f5fe6c6 | [
"MIT"
] | null | null | null | settings.py | chiriiKipkirui/djangoSite | 6ab9c463316ba40a8949a3799355d7b94f5fe6c6 | [
"MIT"
] | null | null | null | """
Django settings for Website project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
f... | 26.125 | 91 | 0.705443 | """
Django settings for Website project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
f... | false | true |
f746add4901dcd71ca73e80cb3e867174b19473a | 3,168 | py | Python | eshop_account/forms.py | mahdikhaligh/store | ed1eb1e76af977d34bbfb01ee5e3ed3d54eff928 | [
"Apache-2.0"
] | null | null | null | eshop_account/forms.py | mahdikhaligh/store | ed1eb1e76af977d34bbfb01ee5e3ed3d54eff928 | [
"Apache-2.0"
] | null | null | null | eshop_account/forms.py | mahdikhaligh/store | ed1eb1e76af977d34bbfb01ee5e3ed3d54eff928 | [
"Apache-2.0"
] | null | null | null | from django import forms
from django.contrib.auth.models import User
from django.core import validators
class LoginForm(forms.Form):
username = forms.CharField(
widget=forms.TextInput(attrs={'placeholder': 'pls enter your username'}),
label='username'
)
password = forms.CharField(
... | 34.434783 | 97 | 0.63447 | from django import forms
from django.contrib.auth.models import User
from django.core import validators
class LoginForm(forms.Form):
username = forms.CharField(
widget=forms.TextInput(attrs={'placeholder': 'pls enter your username'}),
label='username'
)
password = forms.CharField(
... | true | true |
f746ae33440e4dad3cba783fd1b3382adf9f2a1f | 1,508 | py | Python | spinup/algos/tf1/td3/core.py | ANCL/QuadPPO | b7ed0574467bd321f4259175621a12ff7aeb7d12 | [
"MIT"
] | 6,983 | 2018-11-08T08:40:45.000Z | 2022-03-31T11:53:44.000Z | spinup/algos/tf1/td3/core.py | ANCL/QuadPPO | b7ed0574467bd321f4259175621a12ff7aeb7d12 | [
"MIT"
] | 300 | 2018-11-08T20:53:05.000Z | 2022-03-30T07:14:28.000Z | spinup/algos/tf1/td3/core.py | ANCL/QuadPPO | b7ed0574467bd321f4259175621a12ff7aeb7d12 | [
"MIT"
] | 1,880 | 2018-11-08T18:12:48.000Z | 2022-03-31T10:26:24.000Z | import numpy as np
import tensorflow as tf
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=(None,dim) if dim else (None,))
def placeholders(*args):
return [placeholder(dim) for dim in args]
def mlp(x, hidden_sizes=(32,), activation=tf.tanh, output_activation=None):
for h in hidd... | 38.666667 | 109 | 0.671751 | import numpy as np
import tensorflow as tf
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=(None,dim) if dim else (None,))
def placeholders(*args):
return [placeholder(dim) for dim in args]
def mlp(x, hidden_sizes=(32,), activation=tf.tanh, output_activation=None):
for h in hidd... | true | true |
f746ae347a6f10b6f598c54a17e9ec490e163089 | 34,647 | py | Python | OpticalRS/GroundTruthShp.py | melkimble/OpticalRS | 54404f6c1e4e4a6f625e7b15e9f0489cb3600d79 | [
"BSD-3-Clause"
] | 17 | 2016-06-13T02:29:09.000Z | 2022-03-22T13:30:39.000Z | OpticalRS/GroundTruthShp.py | melkimble/OpticalRS | 54404f6c1e4e4a6f625e7b15e9f0489cb3600d79 | [
"BSD-3-Clause"
] | 7 | 2017-09-02T12:50:49.000Z | 2019-02-14T18:32:52.000Z | OpticalRS/GroundTruthShp.py | melkimble/OpticalRS | 54404f6c1e4e4a6f625e7b15e9f0489cb3600d79 | [
"BSD-3-Clause"
] | 14 | 2016-04-02T14:03:34.000Z | 2021-05-18T06:00:45.000Z | """
I'm copying this from some of my much older work. It's probably going to be
buggy. Yep, it was. I've done some refactoring and whatnot but it could probably
use some more. Maybe combine with `GeoDFUtils`? It would be nice to be able to
easily operate on GDF subsets and selections.
`buffer` and `rasterize` are work... | 42.09842 | 138 | 0.592461 | """
I'm copying this from some of my much older work. It's probably going to be
buggy. Yep, it was. I've done some refactoring and whatnot but it could probably
use some more. Maybe combine with `GeoDFUtils`? It would be nice to be able to
easily operate on GDF subsets and selections.
`buffer` and `rasterize` are work... | false | true |
f746ae92a2cda957c4f054def1ab066ee7675580 | 1,931 | py | Python | tabular/src/autogluon/tabular/utils/features/generators/drop_unique.py | mseeger/autogluon-1 | e8d82363ce07fd8e3087bcdd2d71c6f6bd8fd7a0 | [
"Apache-2.0"
] | 1 | 2020-03-20T08:01:35.000Z | 2020-03-20T08:01:35.000Z | tabular/src/autogluon/tabular/utils/features/generators/drop_unique.py | mseeger/autogluon-1 | e8d82363ce07fd8e3087bcdd2d71c6f6bd8fd7a0 | [
"Apache-2.0"
] | null | null | null | tabular/src/autogluon/tabular/utils/features/generators/drop_unique.py | mseeger/autogluon-1 | e8d82363ce07fd8e3087bcdd2d71c6f6bd8fd7a0 | [
"Apache-2.0"
] | 2 | 2021-02-13T04:41:33.000Z | 2021-07-10T07:14:59.000Z | import logging
from pandas import DataFrame
from .abstract import AbstractFeatureGenerator
from ..feature_metadata import FeatureMetadata, R_CATEGORY, R_OBJECT
logger = logging.getLogger(__name__)
# TODO: Not necessary to exist after fitting, can just update outer context feature_out/feature_in and then delete thi... | 41.085106 | 159 | 0.721906 | import logging
from pandas import DataFrame
from .abstract import AbstractFeatureGenerator
from ..feature_metadata import FeatureMetadata, R_CATEGORY, R_OBJECT
logger = logging.getLogger(__name__)
class DropUniqueFeatureGenerator(AbstractFeatureGenerator):
def __init__(self, max_unique_ratio=0.99, **kwargs):
... | true | true |
f746aee8473f35c5e5e0d4620781939cd0abb7cf | 883 | py | Python | tests/test_plotters/test_styles.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 44 | 2020-05-14T01:56:40.000Z | 2022-03-23T11:16:30.000Z | tests/test_plotters/test_styles.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 210 | 2020-05-22T17:33:22.000Z | 2022-03-20T16:50:30.000Z | tests/test_plotters/test_styles.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 9 | 2020-05-16T15:36:02.000Z | 2022-03-23T11:16:56.000Z | # -*- coding: utf-8 -*-
# ======================================================================================================================
# Copyright (©) 2015-2022 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... | 38.391304 | 120 | 0.454134 |
import pytest
from spectrochempy import preferences, plt, os
prefs = preferences
styles = ["poster", "talk", "scpy", "sans", "serif", "grayscale", "notebook", "paper"]
@pytest.mark.parametrize("style", styles)
def test_styles(style):
try:
plt.style.use(style)
except OSError:
plt.styl... | true | true |
f746af6fcfd85dae32b69f9b7617b638bdf3ea62 | 4,433 | py | Python | tests/svm_test.py | QuanZhang-William/mythril-classic | f72387f749a142d8a4e6d1586365d6e9e96a2fed | [
"MIT"
] | 6 | 2021-02-13T05:03:32.000Z | 2021-09-19T14:57:58.000Z | tests/svm_test.py | cryptobarbossa/mythril-classic | 5dd544d301238db2bc536d7cee69b96e9a15e9c4 | [
"MIT"
] | null | null | null | tests/svm_test.py | cryptobarbossa/mythril-classic | 5dd544d301238db2bc536d7cee69b96e9a15e9c4 | [
"MIT"
] | 2 | 2020-05-26T15:03:20.000Z | 2021-07-29T09:09:05.000Z | import json
from mythril.analysis.security import get_detection_module_hooks
from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.callgraph import generate_graph
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SolidityContract
from mythril.mythril... | 36.04065 | 281 | 0.648996 | import json
from mythril.analysis.security import get_detection_module_hooks
from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.callgraph import generate_graph
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SolidityContract
from mythril.mythril... | true | true |
f746afb10af17c592a0f51fcb687870bef119b00 | 6,792 | py | Python | blueoil/cmd/convert.py | yasumura-lm/blueoil | 2149f97862e9a0684f816cc27f16d461b8dcc3ad | [
"Apache-2.0"
] | null | null | null | blueoil/cmd/convert.py | yasumura-lm/blueoil | 2149f97862e9a0684f816cc27f16d461b8dcc3ad | [
"Apache-2.0"
] | null | null | null | blueoil/cmd/convert.py | yasumura-lm/blueoil | 2149f97862e9a0684f816cc27f16d461b8dcc3ad | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 31.155963 | 109 | 0.669317 |
import os
import shutil
import subprocess
from executor.export import run as run_export
from scripts.generate_project import run as run_generate_project
def create_output_directory(output_root_dir, output_template_dir=None):
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
... | true | true |
f746afe7bab596101cfd5f940012ebf667197801 | 1,234 | py | Python | nox/_typing.py | Spectre5/nox | 8261d2ad0a8e3d720c093c30ac56488f53605f85 | [
"Apache-2.0"
] | 700 | 2018-05-13T11:35:04.000Z | 2022-03-19T12:58:56.000Z | nox/_typing.py | Spectre5/nox | 8261d2ad0a8e3d720c093c30ac56488f53605f85 | [
"Apache-2.0"
] | 427 | 2018-05-12T14:18:03.000Z | 2022-03-10T20:46:05.000Z | nox/_typing.py | Spectre5/nox | 8261d2ad0a8e3d720c093c30ac56488f53605f85 | [
"Apache-2.0"
] | 126 | 2018-08-22T21:41:02.000Z | 2022-03-19T09:15:57.000Z | # Copyright 2020 Alethea Katherine Flowers
#
# 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... | 27.422222 | 74 | 0.734198 |
__all__ = ["TYPE_CHECKING", "ClassVar", "NoReturn", "Python"]
import typing as _typing
try:
from typing import TYPE_CHECKING
except ImportError:
try:
from typing_extensions import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False
try:
from typing import NoReturn
ex... | true | true |
f746b0716a0264b102a1cdb10e6cf8496ba322b7 | 488 | py | Python | ml3d/utils/__init__.py | krshrimali/Open3D-ML | e6352ee84d38a4b90c71dd7f376f5570fe849537 | [
"MIT"
] | 447 | 2020-10-14T23:16:41.000Z | 2021-07-27T06:57:45.000Z | ml3d/utils/__init__.py | krshrimali/Open3D-ML | e6352ee84d38a4b90c71dd7f376f5570fe849537 | [
"MIT"
] | 179 | 2021-07-27T15:32:33.000Z | 2022-03-30T14:32:53.000Z | ml3d/utils/__init__.py | krshrimali/Open3D-ML | e6352ee84d38a4b90c71dd7f376f5570fe849537 | [
"MIT"
] | 92 | 2021-07-28T13:50:52.000Z | 2022-03-30T09:24:33.000Z | """Utils for 3D ML."""
from .config import Config
from .log import LogRecord, get_runid, code2md
from .builder import (MODEL, PIPELINE, DATASET, SAMPLER, get_module,
convert_framework_name, convert_device_name)
from .dataset_helper import get_hash, make_dir, Cache
__all__ = [
'Config', 'make... | 34.857143 | 78 | 0.69877 |
from .config import Config
from .log import LogRecord, get_runid, code2md
from .builder import (MODEL, PIPELINE, DATASET, SAMPLER, get_module,
convert_framework_name, convert_device_name)
from .dataset_helper import get_hash, make_dir, Cache
__all__ = [
'Config', 'make_dir', 'LogRecord', 'MO... | true | true |
f746b15fcc46d6cf344f68d57cccb5896e523f6a | 3,994 | py | Python | benchmark/startQiskit1126.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1126.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1126.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=5
# total number=42
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 31.448819 | 82 | 0.616174 |
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as nx
def build_oracle(n: int, f) -... | true | true |
f746b449beaffa6e2367aee4f16fcb7c47023d51 | 1,078 | py | Python | validator/integer.py | honmaple/validator | c8fd3f7637418c7ccb846d1a0a4f8247f69e6bbe | [
"BSD-3-Clause"
] | null | null | null | validator/integer.py | honmaple/validator | c8fd3f7637418c7ccb846d1a0a4f8247f69e6bbe | [
"BSD-3-Clause"
] | null | null | null | validator/integer.py | honmaple/validator | c8fd3f7637418c7ccb846d1a0a4f8247f69e6bbe | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: integer.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2016-12-20 21:30:29 (CST)
# Last Update:星期五 2016-12-23 17:16:21 (CST)
# By:
... | 29.135135 | 76 | 0.479592 |
from .base import Validator
class ValidatorInteger(Validator):
def __call__(self, value):
self.value = value
min = self.kwargs.get('min')
max = self.kwargs.get('max')
size = self.kwargs.get('size')
if min is not None and max is not None:
assert min <... | true | true |
f746b46f2bfb4496c08d270486fbebedd491a220 | 849 | py | Python | src/app.py | MateoProjects/SimplePDFReader | ca20e304d5e897c8ecbf42d25457ab1c893b17c0 | [
"Apache-2.0"
] | null | null | null | src/app.py | MateoProjects/SimplePDFReader | ca20e304d5e897c8ecbf42d25457ab1c893b17c0 | [
"Apache-2.0"
] | null | null | null | src/app.py | MateoProjects/SimplePDFReader | ca20e304d5e897c8ecbf42d25457ab1c893b17c0 | [
"Apache-2.0"
] | null | null | null | import PySimpleGUI as sg
from readerFile import *
sg.theme("BlueMono")
sg.set_options(font=('Helvetica', 10))
layout = [[sg.T("")],
[sg.Text("Choose a file: "), sg.Input(key="-IN2-", change_submits=True), sg.FileBrowse(key="-IN-")],
[sg.Text("Choose a folder"), sg.Input(key="-IN3-", change_submits=... | 30.321429 | 113 | 0.573616 | import PySimpleGUI as sg
from readerFile import *
sg.theme("BlueMono")
sg.set_options(font=('Helvetica', 10))
layout = [[sg.T("")],
[sg.Text("Choose a file: "), sg.Input(key="-IN2-", change_submits=True), sg.FileBrowse(key="-IN-")],
[sg.Text("Choose a folder"), sg.Input(key="-IN3-", change_submits=... | true | true |
f746b4d01878a79dd3f5643cfb3323d0b01c9597 | 6,261 | py | Python | testplan/exporters/testing/pdf/__init__.py | ymn1k/testplan | b1bde8495c449d75a74a7fe4e7c6501b0476f833 | [
"Apache-2.0"
] | null | null | null | testplan/exporters/testing/pdf/__init__.py | ymn1k/testplan | b1bde8495c449d75a74a7fe4e7c6501b0476f833 | [
"Apache-2.0"
] | null | null | null | testplan/exporters/testing/pdf/__init__.py | ymn1k/testplan | b1bde8495c449d75a74a7fe4e7c6501b0476f833 | [
"Apache-2.0"
] | 1 | 2019-09-11T09:13:18.000Z | 2019-09-11T09:13:18.000Z | """
PDF Export logic for test reports via ReportLab.
"""
import os
import uuid
import warnings
try:
from urllib import pathname2url # Python 2.x
except:
from urllib.request import pathname2url # Python 3.x
from schema import Schema, Or
try:
from reportlab.platypus import SimpleDocTemplate
except Exc... | 30.100962 | 79 | 0.659639 |
import os
import uuid
import warnings
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
from schema import Schema, Or
try:
from reportlab.platypus import SimpleDocTemplate
except Exception as exc:
warnings.warn('reportlab must be supported: {}'.format(exc))
tr... | true | true |
f746b55b25b5e7164320c849c9023e69d705d48e | 1,343 | py | Python | scripts/add_taxonomies_to_paleoarxiv.py | gaybro8777/osf.io | 30408511510a40bc393565817b343ef5fd76ab14 | [
"Apache-2.0"
] | 628 | 2015-01-15T04:33:22.000Z | 2022-03-30T06:40:10.000Z | scripts/add_taxonomies_to_paleoarxiv.py | gaybro8777/osf.io | 30408511510a40bc393565817b343ef5fd76ab14 | [
"Apache-2.0"
] | 4,712 | 2015-01-02T01:41:53.000Z | 2022-03-30T14:18:40.000Z | scripts/add_taxonomies_to_paleoarxiv.py | Johnetordoff/osf.io | de10bf249c46cede04c78f7e6f7e352c69e6e6b5 | [
"Apache-2.0"
] | 371 | 2015-01-12T16:14:08.000Z | 2022-03-31T18:58:29.000Z | import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from osf.models import PreprintProvider, Subject
from website.app import init_app
from website impor... | 30.522727 | 116 | 0.760983 | import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from osf.models import PreprintProvider, Subject
from website.app import init_app
from website impor... | true | true |
f746b62b4f4b6d73439630f4f196227fbc7aaa2f | 3,836 | py | Python | cirq/ion/convert_to_ion_gates_test.py | kunalq/Cirq | e73c9bef672e83143ab04e7f169988149055d630 | [
"Apache-2.0"
] | 1 | 2019-09-04T16:55:30.000Z | 2019-09-04T16:55:30.000Z | cirq/ion/convert_to_ion_gates_test.py | 1eedaegon/Cirq | de0c5e855069bba71e55b070fc9b06f58c07a861 | [
"Apache-2.0"
] | null | null | null | cirq/ion/convert_to_ion_gates_test.py | 1eedaegon/Cirq | de0c5e855069bba71e55b070fc9b06f58c07a861 | [
"Apache-2.0"
] | 1 | 2020-12-18T16:36:41.000Z | 2020-12-18T16:36:41.000Z | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 36.884615 | 78 | 0.62513 |
import pytest
import numpy as np
import cirq
class OtherX(cirq.SingleQubitGate):
def _unitary_(self) -> np.ndarray:
return np.array([[0, 1], [1, 0]])
class NoUnitary(cirq.SingleQubitGate):
pass
class OtherCNOT(cirq.TwoQubitGate):
def _unitary_(self) -> np.ndarray:
retur... | true | true |
f746b72f49efbd08191b62aed9bd17f6909c04fe | 7,365 | py | Python | tf2onnx/rewriter/quantization_ops_rewriter.py | garymm/tensorflow-onnx | a8f78ac7903493dee579304b7b1717aa9ec9706f | [
"Apache-2.0"
] | 1 | 2022-03-28T06:21:16.000Z | 2022-03-28T06:21:16.000Z | tf2onnx/rewriter/quantization_ops_rewriter.py | garymm/tensorflow-onnx | a8f78ac7903493dee579304b7b1717aa9ec9706f | [
"Apache-2.0"
] | null | null | null | tf2onnx/rewriter/quantization_ops_rewriter.py | garymm/tensorflow-onnx | a8f78ac7903493dee579304b7b1717aa9ec9706f | [
"Apache-2.0"
] | null | null | null | # SPDX-License-Identifier: Apache-2.0
"""
tf2onnx.rewriter - rewrite tensorflow QuantizeAndDequantizeV2|QuantizeAndDequantizeV3|QuantizeAndDequantizeV4 op
"""
import numpy as np
from onnx import TensorProto, helper
from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher
from tf2onnx import utils
# pylint: dis... | 44.101796 | 120 | 0.605431 |
import numpy as np
from onnx import TensorProto, helper
from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher
from tf2onnx import utils
def extract_numpy_array(node):
return np.frombuffer(node.attr["value"].t.raw_data, dtype="float32")
def create_qdq_nodes(g, match_results):
for match in match_... | true | true |
f746b920b0fc19c99823bce18311d967c046d7b6 | 2,364 | py | Python | sciva/loss.py | ChengF-Lab/scIVA | f70a927531dd16236dff30decbe77f0552ad4f2d | [
"MIT"
] | null | null | null | sciva/loss.py | ChengF-Lab/scIVA | f70a927531dd16236dff30decbe77f0552ad4f2d | [
"MIT"
] | null | null | null | sciva/loss.py | ChengF-Lab/scIVA | f70a927531dd16236dff30decbe77f0552ad4f2d | [
"MIT"
] | 1 | 2022-01-30T17:55:44.000Z | 2022-01-30T17:55:44.000Z | #!/usr/bin/env python
"""
#
#
# File Name: loss_function.py
# Description:
"""
import torch
import torch.nn.functional as F
import math
def kl_divergence(mu, logvar):
"""
Computes the KL-divergence of
some element z.
KL(q||p) = -∫ q(z) log [ p(z) / q(z) ]
= -E[log p(z) ... | 27.811765 | 119 | 0.555415 |
import torch
import torch.nn.functional as F
import math
def kl_divergence(mu, logvar):
return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=1)
def binary_cross_entropy(recon_x, x):
return -torch.sum(x * torch.log(recon_x + 1e-8) + (1 - x) * torch.log(1 - recon_x + 1e-8), dim=-1)
def elbo(r... | true | true |
f746b932f92e4f9c29b61eb26e6f230bdad1ae71 | 9,158 | py | Python | patch_manager_sdk/model/collector_service/alias_metric_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | 5 | 2019-07-31T04:11:05.000Z | 2021-01-07T03:23:20.000Z | patch_manager_sdk/model/collector_service/alias_metric_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | patch_manager_sdk/model/collector_service/alias_metric_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: alias_metric.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... | 47.450777 | 938 | 0.764359 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db ... | true | true |
f746b9933bb631ad1c774ed46f134cf7ad85afb2 | 3,979 | py | Python | NiaPy/util/argparser.py | lukapecnik/NiaPy | a40ac08a4c06a13019ec5e39cc137461884928b0 | [
"MIT"
] | null | null | null | NiaPy/util/argparser.py | lukapecnik/NiaPy | a40ac08a4c06a13019ec5e39cc137461884928b0 | [
"MIT"
] | null | null | null | NiaPy/util/argparser.py | lukapecnik/NiaPy | a40ac08a4c06a13019ec5e39cc137461884928b0 | [
"MIT"
] | 1 | 2020-03-25T16:20:36.000Z | 2020-03-25T16:20:36.000Z | # encoding=utf8
# pylint: disable=mixed-indentation, line-too-long, multiple-statements, too-many-function-args
import sys
import logging
from argparse import ArgumentParser
from numpy import inf
from NiaPy.util.utility import OptimizationType
import NiaPy.benchmarks as bencs
logging.basicConfig()
logger = logging.get... | 34.6 | 170 | 0.707213 |
import sys
import logging
from argparse import ArgumentParser
from numpy import inf
from NiaPy.util.utility import OptimizationType
import NiaPy.benchmarks as bencs
logging.basicConfig()
logger = logging.getLogger('NiaPy.util.argparse')
logger.setLevel('INFO')
__all__ = ['MakeArgParser', 'getArgs', 'getDictArgs']
... | true | true |
f746bad1d975630dd21180afa88f5600bd13a5f5 | 113 | py | Python | openjij/__init__.py | y-yu/OpenJij | ed08460b7c9f8e553d4d33e08977d465472e9c44 | [
"Apache-2.0"
] | null | null | null | openjij/__init__.py | y-yu/OpenJij | ed08460b7c9f8e553d4d33e08977d465472e9c44 | [
"Apache-2.0"
] | null | null | null | openjij/__init__.py | y-yu/OpenJij | ed08460b7c9f8e553d4d33e08977d465472e9c44 | [
"Apache-2.0"
] | null | null | null | from .sampler import Sampler, SASampler, SQASampler
from .model import BinaryQuadraticModel
from .utils import *
| 28.25 | 51 | 0.823009 | from .sampler import Sampler, SASampler, SQASampler
from .model import BinaryQuadraticModel
from .utils import *
| true | true |
f746bad9218690891dac47f8b8643f458cd66fff | 1,278 | py | Python | code_week15_83_89/palindrome_pairs_hard.py | dylanlee101/leetcode | b059afdadb83d504e62afd1227107de0b59557af | [
"Apache-2.0"
] | null | null | null | code_week15_83_89/palindrome_pairs_hard.py | dylanlee101/leetcode | b059afdadb83d504e62afd1227107de0b59557af | [
"Apache-2.0"
] | null | null | null | code_week15_83_89/palindrome_pairs_hard.py | dylanlee101/leetcode | b059afdadb83d504e62afd1227107de0b59557af | [
"Apache-2.0"
] | null | null | null | '''
给定一组唯一的单词, 找出所有不同 的索引对(i, j),使得列表中的两个单词, words[i] + words[j] ,可拼接成回文串。
示例 1:
输入: ["abcd","dcba","lls","s","sssll"]
输出: [[0,1],[1,0],[3,2],[2,4]]
解释: 可拼接成的回文串为 ["dcbaabcd","abcddcba","slls","llssssll"]
示例 2:
输入: ["bat","tab","cat"]
输出: [[0,1],[1,0]]
解释: 可拼接成的回文串为 ["battab","tabbat"]
来源:力扣(LeetCode)
链接:https://le... | 31.170732 | 70 | 0.503912 | class Solution:
def palindromePairs(self, words: List[str]) -> List[List[int]]:
def findWord(s,left,right):
return indices.get(s[left:right+1],-1)
def isPalindrome(s,left,right):
return (sub := s[left:right+1]) == sub[::-1]
n = len(words)
indices = {word[::-1... | true | true |
f746bb2d949c6f81d55b80da5938ebb5349804e8 | 12,941 | py | Python | tensorflow/python/framework/function_def_to_graph.py | sighingnow/tensorflow | 12579f9a795da54db405b5918f709665e2a7c07f | [
"Apache-2.0"
] | null | null | null | tensorflow/python/framework/function_def_to_graph.py | sighingnow/tensorflow | 12579f9a795da54db405b5918f709665e2a7c07f | [
"Apache-2.0"
] | null | null | null | tensorflow/python/framework/function_def_to_graph.py | sighingnow/tensorflow | 12579f9a795da54db405b5918f709665e2a7c07f | [
"Apache-2.0"
] | 1 | 2022-01-26T18:52:28.000Z | 2022-01-26T18:52:28.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.952532 | 93 | 0.70211 |
import itertools
from tensorflow.core.framework import function_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.core.framework import tensor_shape_pb2
from tensorflow.core.framework import types_pb2
from tensorflow.core.framework import versions_pb2
from tensorflow.python.eager impo... | true | true |
f746bbffac729c7d59fe0ffc5a0ea91974977612 | 15,722 | py | Python | intersight/apis/iaas_license_info_api.py | ategaw-cisco/intersight-python | 9d6476620507281b1dc358e29ac452d56081bbb0 | [
"Apache-2.0"
] | null | null | null | intersight/apis/iaas_license_info_api.py | ategaw-cisco/intersight-python | 9d6476620507281b1dc358e29ac452d56081bbb0 | [
"Apache-2.0"
] | null | null | null | intersight/apis/iaas_license_info_api.py | ategaw-cisco/intersight-python | 9d6476620507281b1dc358e29ac452d56081bbb0 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-262
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from s... | 55.55477 | 818 | 0.644129 |
from __future__ import absolute_import
import sys
import os
import re
from six import iteritems
from ..configuration import Configuration
from ..api_client import ApiClient
class IaasLicenseInfoApi(object):
def __init__(self, api_client=None):
config = Configuration()
if api_client:
... | true | true |
f746bc2386bea1def31b6b8300da4462f7ec7411 | 3,731 | py | Python | subcmds/download.py | phamvandai/git-repo | d92076d930af11bb9a3025a6b2f12ca139c0436f | [
"Apache-2.0"
] | 22 | 2017-05-02T07:48:13.000Z | 2021-12-23T10:22:23.000Z | subcmds/download.py | phamvandai/git-repo | d92076d930af11bb9a3025a6b2f12ca139c0436f | [
"Apache-2.0"
] | null | null | null | subcmds/download.py | phamvandai/git-repo | d92076d930af11bb9a3025a6b2f12ca139c0436f | [
"Apache-2.0"
] | 18 | 2017-07-07T06:31:44.000Z | 2021-12-06T08:11:17.000Z | # -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... | 32.443478 | 74 | 0.591262 |
from __future__ import print_function
import re
import sys
from command import Command
from error import GitError
CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$')
class Download(Command):
common = True
helpSummary = "Download and checkout a change"
helpUsage = """
%prog {[proj... | true | true |
f746bdad7a2aa221a82cd4446bd10959a3f13a00 | 61,178 | py | Python | modules/templates/SAMBRO/config.py | sungkomp/-SAHANA-EDEN | 5fdb9ec60c0ca9548f6b6bac6ac110a22fc4d933 | [
"MIT"
] | null | null | null | modules/templates/SAMBRO/config.py | sungkomp/-SAHANA-EDEN | 5fdb9ec60c0ca9548f6b6bac6ac110a22fc4d933 | [
"MIT"
] | null | null | null | modules/templates/SAMBRO/config.py | sungkomp/-SAHANA-EDEN | 5fdb9ec60c0ca9548f6b6bac6ac110a22fc4d933 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import json
from collections import OrderedDict
from gluon import current
from gluon.html import *
from gluon.storage import Storage
from gluon.languages import lazyT
from s3 import FS, s3_str
def config(settings):
"""
Template settings for CAP: Common Alerting Protocol
"""
... | 45.655224 | 218 | 0.457321 |
import json
from collections import OrderedDict
from gluon import current
from gluon.html import *
from gluon.storage import Storage
from gluon.languages import lazyT
from s3 import FS, s3_str
def config(settings):
"""
Template settings for CAP: Common Alerting Protocol
"""
T = current.T
... | false | true |
f746be3e52038c4ee6654b7a2f232765d0b88aba | 6,645 | py | Python | tempest/api/compute/v3/servers/test_server_metadata_negative.py | rcbops-qe/tempest | 88960aa32c473b64072671541a136dbae41b1d4c | [
"Apache-2.0"
] | 3 | 2015-03-03T15:43:06.000Z | 2016-10-24T06:12:40.000Z | tempest/api/compute/v3/servers/test_server_metadata_negative.py | rcbops-qe/tempest | 88960aa32c473b64072671541a136dbae41b1d4c | [
"Apache-2.0"
] | null | null | null | tempest/api/compute/v3/servers/test_server_metadata_negative.py | rcbops-qe/tempest | 88960aa32c473b64072671541a136dbae41b1d4c | [
"Apache-2.0"
] | 1 | 2017-07-11T13:54:27.000Z | 2017-07-11T13:54:27.000Z | # Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 42.596154 | 79 | 0.621219 |
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest import test
class ServerMetadataV3NegativeTest(base.BaseV3ComputeTest):
@classmethod
def setUpClass(cls):
super(ServerMetadataV3NegativeTest, cls).setUpClass()
... | true | true |
f746be672f6519792c9906419d65f11978bbca04 | 7,360 | py | Python | benchmarks/01-LE10-Thick-Plate/Model_Code_Aster/mesh_convergence/salome_prepare_mesh.py | dantelimac/CoFEA | b5520c66fa5f62d0ceadffd7cef6cae463ea5084 | [
"BSD-4-Clause"
] | null | null | null | benchmarks/01-LE10-Thick-Plate/Model_Code_Aster/mesh_convergence/salome_prepare_mesh.py | dantelimac/CoFEA | b5520c66fa5f62d0ceadffd7cef6cae463ea5084 | [
"BSD-4-Clause"
] | null | null | null | benchmarks/01-LE10-Thick-Plate/Model_Code_Aster/mesh_convergence/salome_prepare_mesh.py | dantelimac/CoFEA | b5520c66fa5f62d0ceadffd7cef6cae463ea5084 | [
"BSD-4-Clause"
] | null | null | null | #!/usr/bin/env python
"""
Script for running in salome to automatically create regular mesh for thick_plate_benchmark
Change PATH_TO_EXPORT_MESH to your own path.
You can also change MESH_MULTIPLIER to make mesh more or less dense.
"""
###
### SALOME v9.3.0
###
import sys
import salome
salome.salome_init()
import s... | 36.984925 | 112 | 0.690489 |
salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
geomBuilder
import math
import SALOMEDS
print("###")
PATH_TO_EXPORT_MESH = sys.argv[1]
print(f"PATH_TO_EXPORT_MESH: {PATH_TO_EXPORT_MESH} type:{type(PATH_TO_EXPORT_MESH)}")
MESH_MULTIPLIER = int(sys.argv[2])
print(f"MESH_MULTIPLIER: {M... | true | true |
f746be82411ef1ae9bce517ff6eaf845ce70fdce | 2,344 | py | Python | tensorflow/python/kernel_tests/array_ops/denormal_test.py | KosingZhu/tensorflow | 7ac2521a4e609ddef0f0ea3ffc2e76102da934d7 | [
"Apache-2.0"
] | 190,993 | 2015-11-09T13:17:30.000Z | 2022-03-31T23:05:27.000Z | tensorflow/python/kernel_tests/denormal_test.py | govl-psb/tensorflow-1 | 60028072a1c3b4376e145b6fea8e4ccd3324377f | [
"Apache-2.0"
] | 48,461 | 2015-11-09T14:21:11.000Z | 2022-03-31T23:17:33.000Z | tensorflow/python/kernel_tests/denormal_test.py | govl-psb/tensorflow-1 | 60028072a1c3b4376e145b6fea8e4ccd3324377f | [
"Apache-2.0"
] | 104,981 | 2015-11-09T13:40:17.000Z | 2022-03-31T19:51:54.000Z | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 38.42623 | 89 | 0.703925 |
import numpy as np
import platform
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import test_util
from tensorflow.python.platform import test
class DenormalTest(test.TestCase):
def testPythonHasDenormals(self):
for dtype in np.float32, np.float64:
ti... | true | true |
f746bf3372d58ae4dd8afbafebbf61219b2d6bb4 | 5,577 | py | Python | tfx/dsl/compiler/testdata/iris_pipeline_async.py | avelez93/tfx | 75fbb6a7d50e99138609be3ca4c3a204a13a2195 | [
"Apache-2.0"
] | 1 | 2022-03-29T23:06:54.000Z | 2022-03-29T23:06:54.000Z | tfx/dsl/compiler/testdata/iris_pipeline_async.py | avelez93/tfx | 75fbb6a7d50e99138609be3ca4c3a204a13a2195 | [
"Apache-2.0"
] | null | null | null | tfx/dsl/compiler/testdata/iris_pipeline_async.py | avelez93/tfx | 75fbb6a7d50e99138609be3ca4c3a204a13a2195 | [
"Apache-2.0"
] | 1 | 2020-12-13T22:07:53.000Z | 2020-12-13T22:07:53.000Z | # Copyright 2020 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... | 39.274648 | 80 | 0.711135 |
import os
import tensorflow_model_analysis as tfma
from tfx.components import CsvExampleGen
from tfx.components import Evaluator
from tfx.components import ExampleValidator
from tfx.components import Pusher
from tfx.components import SchemaGen
from tfx.components import StatisticsGen
from tfx.components i... | true | true |
f746bf5296f93da1338862dd2aa3e74f395bbdb5 | 37,398 | py | Python | xclim/indices/_conversion.py | UCL/xclim | 118441f89d221cfffbd2e1fd0b966517e731378d | [
"Apache-2.0"
] | null | null | null | xclim/indices/_conversion.py | UCL/xclim | 118441f89d221cfffbd2e1fd0b966517e731378d | [
"Apache-2.0"
] | 2 | 2021-07-16T16:05:54.000Z | 2021-11-15T13:02:10.000Z | xclim/indices/_conversion.py | UCL/xclim | 118441f89d221cfffbd2e1fd0b966517e731378d | [
"Apache-2.0"
] | 1 | 2021-07-16T16:49:05.000Z | 2021-07-16T16:49:05.000Z | # noqa: D100
from typing import Optional, Tuple
import numpy as np
import xarray as xr
from xclim.core.calendar import date_range, datetime_to_decimal_year
from xclim.core.units import amount2rate, convert_units_to, declare_units, units2pint
__all__ = [
"humidex",
"tas",
"uas_vas_2_sfcwind",
"sfcwind... | 37.435435 | 313 | 0.625221 |
from typing import Optional, Tuple
import numpy as np
import xarray as xr
from xclim.core.calendar import date_range, datetime_to_decimal_year
from xclim.core.units import amount2rate, convert_units_to, declare_units, units2pint
__all__ = [
"humidex",
"tas",
"uas_vas_2_sfcwind",
"sfcwind_2_uas_vas",... | true | true |
f746c149980b20019a3598c376b1be40dd61b9ca | 7,823 | py | Python | tests/test_ORACLE.py | AQ18/skimpy | 435fc50244f2ca815bbb39d525a82a4692f5c0ac | [
"Apache-2.0"
] | 13 | 2020-11-05T10:59:13.000Z | 2022-03-21T01:38:31.000Z | tests/test_ORACLE.py | AQ18/skimpy | 435fc50244f2ca815bbb39d525a82a4692f5c0ac | [
"Apache-2.0"
] | 4 | 2022-01-27T10:23:40.000Z | 2022-03-10T18:16:06.000Z | tests/test_ORACLE.py | AQ18/skimpy | 435fc50244f2ca815bbb39d525a82a4692f5c0ac | [
"Apache-2.0"
] | 6 | 2020-08-04T17:01:33.000Z | 2022-03-21T01:38:32.000Z | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... | 31.292 | 108 | 0.715327 |
import pytest
import numpy as np
import pytfa
from pytfa.io import import_matlab_model, load_thermoDB
from pytfa.io.viz import get_reaction_data
from skimpy.utils.namespace import *
from skimpy.sampling.simple_parameter_sampler import SimpleParameterSampler
from skimpy.core.solution import ODESolutionPopulation
fr... | true | true |
f746c16fea3027a482c679020427437ced86395f | 589 | py | Python | examples/camera.py | cloudmesh/cloudmesh.pi | bdf706b3763031341c41b811749064c293e73c14 | [
"Apache-2.0"
] | 2 | 2017-09-18T00:56:36.000Z | 2018-06-01T23:41:23.000Z | examples/camera.py | cloudmesh/cloudmesh-pi | bdf706b3763031341c41b811749064c293e73c14 | [
"Apache-2.0"
] | 1 | 2018-04-16T18:37:17.000Z | 2018-04-16T18:37:17.000Z | examples/camera.py | cloudmesh/cloudmesh.pi | bdf706b3763031341c41b811749064c293e73c14 | [
"Apache-2.0"
] | 3 | 2017-09-20T11:13:54.000Z | 2017-11-30T23:48:37.000Z | ###
# if you dont have picamera installed run sudo apt-get install python-picamera
# and emable camera in raspberrypi configuration
#
#
# this progam uses raspberry pi onboarc camera to capture an image and save it to a file
#
# wait for 5 seconds
# capture the image
# save the mage to image.jpg file
#
# for more infor... | 21.035714 | 88 | 0.741935 |
mport picamera
import time
camera = picamera.PiCamera()
count = 5
while count >0:
print "capturing image in : ", count
count -= 1
time.sleep(1)
camera.capture("image.jpg")
| false | true |
f746c206a17a8a36f618dd9485f2a33be4d66bff | 13,852 | py | Python | src/oci/data_integration/models/schedule_summary.py | Manny27nyc/oci-python-sdk | de60b04e07a99826254f7255e992f41772902df7 | [
"Apache-2.0",
"BSD-3-Clause"
] | 249 | 2017-09-11T22:06:05.000Z | 2022-03-04T17:09:29.000Z | src/oci/data_integration/models/schedule_summary.py | Manny27nyc/oci-python-sdk | de60b04e07a99826254f7255e992f41772902df7 | [
"Apache-2.0",
"BSD-3-Clause"
] | 228 | 2017-09-11T23:07:26.000Z | 2022-03-23T10:58:50.000Z | src/oci/data_integration/models/schedule_summary.py | Manny27nyc/oci-python-sdk | de60b04e07a99826254f7255e992f41772902df7 | [
"Apache-2.0",
"BSD-3-Clause"
] | 224 | 2017-09-27T07:32:43.000Z | 2022-03-25T16:55:42.000Z | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 32.139211 | 245 | 0.648137 |
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class ScheduleSummary(object):
def __init__(self, **kwargs):
self.swagger_types = {
'key': 'str',
... | true | true |
f746c231bfdd9b1bb8345e10ed8625959a208a0e | 10,166 | py | Python | stolos/runner.py | sailthru/stolos | 7b74da527033b2da7f3ccd6d19ed6fb0245ea0fc | [
"Apache-2.0"
] | 121 | 2015-01-20T08:58:35.000Z | 2021-08-08T15:13:11.000Z | stolos/runner.py | sailthru/stolos | 7b74da527033b2da7f3ccd6d19ed6fb0245ea0fc | [
"Apache-2.0"
] | 3 | 2015-01-20T22:19:49.000Z | 2016-02-10T10:48:11.000Z | stolos/runner.py | sailthru/stolos | 7b74da527033b2da7f3ccd6d19ed6fb0245ea0fc | [
"Apache-2.0"
] | 20 | 2016-02-03T17:08:31.000Z | 2021-04-19T10:43:28.000Z | """
This code fetches jobs from the queue, decides whether to run jobs, and then
runs them or manipulates its own and parent/child queues
"""
import importlib
from stolos import argparse_shared as at
from stolos import log
from stolos import dag_tools as dt, exceptions
from stolos import queue_backend as qb
from stolo... | 37.10219 | 79 | 0.627681 | import importlib
from stolos import argparse_shared as at
from stolos import log
from stolos import dag_tools as dt, exceptions
from stolos import queue_backend as qb
from stolos import configuration_backend as cb
from stolos.initializer import initialize
def main(ns):
assert ns.app_name in dt.get_task_names()
... | true | true |
f746c27550ecb45c5b905798c8ae426acbabea66 | 1,264 | py | Python | entertainment.py | Shubhamkansal20/movie_trailer_website | b2b0541f9778a255d76d68a445c86ced4a63e9cc | [
"MIT"
] | null | null | null | entertainment.py | Shubhamkansal20/movie_trailer_website | b2b0541f9778a255d76d68a445c86ced4a63e9cc | [
"MIT"
] | null | null | null | entertainment.py | Shubhamkansal20/movie_trailer_website | b2b0541f9778a255d76d68a445c86ced4a63e9cc | [
"MIT"
] | null | null | null |
import fresh_tomatoes
# import fresh_tomatoes from library
import media
# import class
# first object created
Bahubali = media.Movies('Bahubali', 'The ancient kingdom of Mahishmati'
,
'https://i.ytimg.com/vi/JS4drCVGIms/maxresdefault.jpg'
... | 28.727273 | 116 | 0.584652 |
import fresh_tomatoes
import media
Bahubali = media.Movies('Bahubali', 'The ancient kingdom of Mahishmati'
,
'https://i.ytimg.com/vi/JS4drCVGIms/maxresdefault.jpg'
, 'https://www.youtube.com/watch?v=sw6VKIClRMY')
Don = m... | true | true |
f746c484d6cd7abb6e36c1fdde335679097ff559 | 293 | py | Python | python3/web/Scanner_website/robots.py | SaiHarshaK/Penetration-Testing-Tools | 83cffc252b011a979c862e1f1cce7fa84a13dfd1 | [
"MIT"
] | null | null | null | python3/web/Scanner_website/robots.py | SaiHarshaK/Penetration-Testing-Tools | 83cffc252b011a979c862e1f1cce7fa84a13dfd1 | [
"MIT"
] | null | null | null | python3/web/Scanner_website/robots.py | SaiHarshaK/Penetration-Testing-Tools | 83cffc252b011a979c862e1f1cce7fa84a13dfd1 | [
"MIT"
] | null | null | null | import urllib.request
import io
def robots(url):
if url.endswith('/'):
path = url
else:
path = url + '/'
req = urllib.request.Request(path + "robots.txt", data = None) #request
resp = urllib.request.urlopen(req) #response
data = resp.read()
return data | 24.416667 | 75 | 0.607509 | import urllib.request
import io
def robots(url):
if url.endswith('/'):
path = url
else:
path = url + '/'
req = urllib.request.Request(path + "robots.txt", data = None)
resp = urllib.request.urlopen(req)
data = resp.read()
return data | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.