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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3b57690a12ceecf8678804ef6ad197cfd0f51d | 154,195 | py | Python | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | """tests of joined-eager loaded attributes"""
from sqlalchemy.testing import eq_, is_, is_not_
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy.orm import joinedload, deferred, undefer, \
joinedload_all, backref, Session,\
defaultload, Load, load_only
from sqlalchemy import Integer, Strin... | 36.879933 | 79 | 0.513331 |
from sqlalchemy.testing import eq_, is_, is_not_
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy.orm import joinedload, deferred, undefer, \
joinedload_all, backref, Session,\
defaultload, Load, load_only
from sqlalchemy import Integer, String, Date, ForeignKey, and_, select, \
func,... | true | true |
1c3b57aeaf4fd15721d9e0c57215bb330c0fdb16 | 756 | py | Python | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2,360 | 2017-11-06T08:47:01.000Z | 2022-03-31T14:45:33.000Z | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 13,838 | 2017-11-04T07:49:45.000Z | 2022-03-31T23:38:39.000Z | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1,793 | 2017-11-04T07:45:50.000Z | 2022-03-30T14:31:53.000Z | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFastcov(PythonPackage):
"""
A parallelized gcov wrapper for generating intermediate ... | 30.24 | 94 | 0.715608 |
from spack import *
class PyFastcov(PythonPackage):
homepage = "https://github.com/RPGillespie6/fastcov"
pypi = "fastcov/fastcov-1.13.tar.gz"
maintainers = ['haampie']
version('1.13', sha256='ec8a5271f90a2f8b894cb999e262c33e225ed6072d9a6ca38f636f88cc0543e8')
depends_on('python@3.... | true | true |
1c3b57da8d3433fdd503a15495d4fbd01591b59f | 712 | py | Python | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | liuxiaomiao123/NeuroMathAcademy | 16a7969604a300bf9fbb86f8a5b26050ebd14c65 | [
"CC-BY-4.0"
] | 2 | 2020-07-03T04:39:09.000Z | 2020-07-12T02:08:31.000Z | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | NinaHKivanani/course-content | 3c91dd1a669cebce892486ba4f8086b1ef2e1e49 | [
"CC-BY-4.0"
] | 1 | 2020-06-22T22:57:03.000Z | 2020-06-22T22:57:03.000Z | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | NinaHKivanani/course-content | 3c91dd1a669cebce892486ba4f8086b1ef2e1e49 | [
"CC-BY-4.0"
] | 1 | 2021-04-26T11:30:26.000Z | 2021-04-26T11:30:26.000Z | with plt.xkcd():
mu_posteriors = []
max_posteriors = []
for mu_visual in mu_visuals:
max_posterior = compute_mode_posterior_multiply(x,
mu_auditory, sigma_auditory,
mu_visual, sigma_visual)
... | 35.6 | 81 | 0.508427 | with plt.xkcd():
mu_posteriors = []
max_posteriors = []
for mu_visual in mu_visuals:
max_posterior = compute_mode_posterior_multiply(x,
mu_auditory, sigma_auditory,
mu_visual, sigma_visual)
... | true | true |
1c3b58290e3527f2bd100b7ab4eee0f95395fece | 5,385 | py | Python | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | 1 | 2022-03-25T09:30:24.000Z | 2022-03-25T09:30:24.000Z | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | null | null | null | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3 -u
# Copyright 2022 The OFA-Sys Team.
# All rights reserved.
# This source code is licensed under the Apache 2.0 license
# found in the LICENSE file in the root directory.
import logging
import os
import sys
import numpy as np
import torch
from fairseq import distributed_utils, options, tasks... | 38.741007 | 280 | 0.712906 |
import logging
import os
import sys
import numpy as np
import torch
from fairseq import distributed_utils, options, tasks, utils
from fairseq.dataclass.utils import convert_namespace_to_omegaconf
from fairseq.logging import progress_bar
from fairseq.utils import reset_logging
from omegaconf import DictConfig
fr... | true | true |
1c3b582ae8514b7fd13c1904986f59e812406230 | 974 | py | Python | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 25 | 2018-07-20T22:31:40.000Z | 2021-07-15T16:58:41.000Z | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 13 | 2018-06-18T23:08:47.000Z | 2022-02-10T07:38:25.000Z | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 6 | 2018-05-17T21:59:43.000Z | 2020-11-17T00:30:26.000Z | from django.contrib.gis.db import models
from trr.constants import (
ACTION_PERSON_CHOICES,
RESISTANCE_TYPE_CHOICES,
RESISTANCE_LEVEL_CHOICES,
)
from data.models.common import TimeStampsModel
class ActionResponse(TimeStampsModel):
trr = models.ForeignKey('trr.TRR', on_delete=models.CASCADE)
perso... | 44.272727 | 99 | 0.785421 | from django.contrib.gis.db import models
from trr.constants import (
ACTION_PERSON_CHOICES,
RESISTANCE_TYPE_CHOICES,
RESISTANCE_LEVEL_CHOICES,
)
from data.models.common import TimeStampsModel
class ActionResponse(TimeStampsModel):
trr = models.ForeignKey('trr.TRR', on_delete=models.CASCADE)
perso... | true | true |
1c3b598fd837994e810cd2153f3b614a4572e952 | 19,110 | py | Python | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 2 | 2021-05-04T15:12:37.000Z | 2021-09-08T10:04:41.000Z | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 35 | 2021-05-04T12:39:26.000Z | 2022-03-28T09:20:19.000Z | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 6 | 2021-04-28T14:49:48.000Z | 2022-01-07T15:29:05.000Z | # -*- coding: utf-8 -*-
"""Archivist connection interface
This module contains the base Archivist class which manages
the connection parameters to a Jitsuin Archivist instance and
the basic REST verbs to GET, POST, PATCH and DELETE entities..
The REST methods in this class should only be used directly whe... | 28.998483 | 94 | 0.595552 |
import logging
import json
from collections import deque
from copy import deepcopy
from time import time
from typing import BinaryIO, Dict, List, Optional, Union
import requests
from requests.models import Response
from requests_toolbelt.multipart.encoder import MultipartEncoder
from .constants import (
HEADE... | true | true |
1c3b59dbe20d910f2d3a6fecad9830bae1f18a2b | 8,578 | py | Python | basicRAT_server.py | reznok/basicRAT | 6b4d40486ee41438e52418a04d508eb9cfcec5cc | [
"Unlicense"
] | 2 | 2021-02-21T18:46:58.000Z | 2021-02-21T18:47:55.000Z | basicRAT_server.py | reznok/basicRAT | 6b4d40486ee41438e52418a04d508eb9cfcec5cc | [
"Unlicense"
] | null | null | null | basicRAT_server.py | reznok/basicRAT | 6b4d40486ee41438e52418a04d508eb9cfcec5cc | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# basicRAT server
# https://github.com/vesche/basicRAT
#
import argparse
import readline
import socket
import struct
import sys
import threading
import time
from core import common
from core import crypto
from core import filesock
# ascii banner (Crawford2) - http://... | 31.888476 | 82 | 0.526929 |
import argparse
import readline
import socket
import struct
import sys
import threading
import time
from core import common
from core import crypto
from core import filesock
BANNER = '''
____ ____ _____ ____ __ ____ ____ ______ . ,
| \ / |/ ___/| | / ]| \ / || | ... | false | true |
1c3b5a486742d083e08034ad044e4be97599f9a4 | 7,493 | py | Python | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 6 | 2021-01-23T22:21:41.000Z | 2021-06-30T00:45:34.000Z | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 46 | 2021-01-02T02:52:42.000Z | 2022-03-28T18:54:48.000Z | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 2 | 2021-04-20T05:20:45.000Z | 2021-04-20T05:28:13.000Z | """
Django settings for surveysite project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathli... | 27.751852 | 131 | 0.669558 |
from pathlib import Path
from django.contrib.messages import constants as message_constants
import os
import datetime
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
SECRET_KEY = os.environ.get('WEBSITE_SECRET')
REDDIT_OAUTH_SECRET = os.environ.get('WEBSITE_REDDIT_OAUTH_SECRET')
REDDIT_OAUTH_CLI... | true | true |
1c3b5a934e3be37f7112f3b58cc9fd7dc8ef632a | 7,743 | py | Python | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import os
import sys
import glob
import pkg_resources
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "1.3"
# Add any Sphinx extension module ... | 30.604743 | 88 | 0.718455 |
import os
import sys
import glob
import pkg_resources
needs_sphinx = "1.3"
extensions = [
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
... | true | true |
1c3b5b74f45d677071fa6a87f980d8bd333fdc67 | 3,980 | py | Python | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | 3 | 2017-12-21T06:17:55.000Z | 2019-03-15T16:37:45.000Z | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | null | null | null | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | null | null | null | """
Standalone code for parsing phue sensor data.
Robin Cole. 19-12-2017
"""
from phue import Bridge
__version__ = 1.0
def get_response_from_ip(bridge_ip):
"""Returns the phue sensors response for a bridge_ip."""
b = Bridge(bridge_ip)
response = b.get_sensor_objects('name')
return response
def pars... | 31.338583 | 78 | 0.557286 | from phue import Bridge
__version__ = 1.0
def get_response_from_ip(bridge_ip):
b = Bridge(bridge_ip)
response = b.get_sensor_objects('name')
return response
def parse_sml(response):
if response.type == "ZLLLightLevel":
lightlevel = response.state['lightlevel']
if lightlevel is not N... | true | true |
1c3b5b94e089f52f18d59ebd2d3121a21de46f0a | 2,449 | py | Python | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
... | 31 | 92 | 0.639853 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
self,
circuit: 'cirq.Circuit',
index: int,
op: 'cirq.Operation'
) -> Optional[cirq.Poi... | true | true |
1c3b5c6e0d48501de1a38795e0fcf84cb9e36606 | 16,927 | py | Python | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 69 | 2019-12-14T06:04:54.000Z | 2022-03-24T08:58:23.000Z | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 60 | 2020-04-02T13:19:20.000Z | 2022-03-31T10:24:43.000Z | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 21 | 2020-04-02T10:04:51.000Z | 2022-03-23T17:34:10.000Z | import logging
import numpy as np
import yaml
import ast
import jsonpickle
import json
import os
from pathlib import Path
import copy
from itertools import combinations
from seml.sources import import_exe
from seml.parameters import sample_random_configs, generate_grid, cartesian_product_dict
from seml.utils import me... | 38.734554 | 120 | 0.659184 | import logging
import numpy as np
import yaml
import ast
import jsonpickle
import json
import os
from pathlib import Path
import copy
from itertools import combinations
from seml.sources import import_exe
from seml.parameters import sample_random_configs, generate_grid, cartesian_product_dict
from seml.utils import me... | true | true |
1c3b5d034c1f5cc82d2da4d439996a66a0eefad5 | 16 | py | Python | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | null | null | null | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | 1 | 2018-04-24T03:26:56.000Z | 2018-05-09T17:10:55.000Z | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | 1 | 2018-04-23T20:52:43.000Z | 2018-04-23T20:52:43.000Z | #read_in__init__ | 16 | 16 | 0.9375 | true | true | |
1c3b5d09ff767e14087b63a78fa7d9321583e55c | 3,951 | py | Python | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial-canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | null | null | null | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial-canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | 2 | 2021-08-21T14:03:45.000Z | 2021-10-01T11:32:11.000Z | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial_canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | null | null | null | from functools import partial
from bokeh.plotting import figure as bokeh_figure
from bokeh.models import CustomJS
from financial_canvas.figures.utils import create_sources
from financial_canvas.figures.utils import read_file
class CustomFigure(object):
'''
A base class for creating bokeh figures that will fi... | 42.031915 | 99 | 0.618578 | from functools import partial
from bokeh.plotting import figure as bokeh_figure
from bokeh.models import CustomJS
from financial_canvas.figures.utils import create_sources
from financial_canvas.figures.utils import read_file
class CustomFigure(object):
def __init__(self, df, *, selected_from=None):
if se... | true | true |
1c3b5d954ad0aee1b9e5fb0e78f9cd2780d1d5a1 | 1,330 | py | Python | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | 1 | 2020-12-20T09:49:10.000Z | 2020-12-20T09:49:10.000Z | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | 1 | 2020-10-22T03:39:50.000Z | 2020-11-02T18:30:49.000Z | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | null | null | null | import torch
import numpy as np
import torch.nn.functional as F
def kl_divergence(mu, sigma, mu_prior, sigma_prior):
kl = 0.5 * (2 * torch.log(sigma_prior / sigma) - 1 + (sigma / sigma_prior).pow(2) + ((mu_prior - mu) / sigma_prior).pow(2)).sum()
return kl
def normpdf(x, mu=0.0, sigma=0.3):
m =... | 44.333333 | 135 | 0.606767 | import torch
import numpy as np
import torch.nn.functional as F
def kl_divergence(mu, sigma, mu_prior, sigma_prior):
kl = 0.5 * (2 * torch.log(sigma_prior / sigma) - 1 + (sigma / sigma_prior).pow(2) + ((mu_prior - mu) / sigma_prior).pow(2)).sum()
return kl
def normpdf(x, mu=0.0, sigma=0.3):
m =... | true | true |
1c3b605c52be0f323cf4325abca5c1af9c2a8497 | 1,172 | py | Python | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | 2 | 2022-01-27T22:30:42.000Z | 2022-01-29T14:14:30.000Z | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | null | null | null | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | null | null | null | import numpy as np
import torch
from torch import nn
def init_weights(m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
nn.init.kaiming_uniform_(m.weight)
nn.init.zeros_(m.bias)
elif classname.find('BatchNorm') != -1:
... | 39.066667 | 122 | 0.654437 | import numpy as np
import torch
from torch import nn
def init_weights(m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
nn.init.kaiming_uniform_(m.weight)
nn.init.zeros_(m.bias)
elif classname.find('BatchNorm') != -1:
... | true | true |
1c3b60a25714179eb4cd256f5f9c22f959be1f17 | 19,206 | py | Python | src/CLI/actioner/sonic_cli_if.py | project-arlo/sonic-mgmt-framework | 562cd84ff3fec9ca705c7df621742f2daa61ce71 | [
"Apache-2.0"
] | 7 | 2019-10-17T06:12:02.000Z | 2021-09-08T11:16:19.000Z | src/CLI/actioner/sonic_cli_if.py | noolex/sonic-mgmt-framework | 5493889adc47fc584b04dca1a0cc0a2007211df4 | [
"Apache-2.0"
] | 207 | 2019-06-24T04:48:11.000Z | 2020-05-06T05:51:37.000Z | src/CLI/actioner/sonic_cli_if.py | noolex/sonic-mgmt-framework | 5493889adc47fc584b04dca1a0cc0a2007211df4 | [
"Apache-2.0"
] | 20 | 2019-06-27T19:24:45.000Z | 2021-07-15T21:12:30.000Z | #!/usr/bin/python
###########################################################################
#
# Copyright 2019 Dell, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | 49.246154 | 228 | 0.643549 |
nfig-interfaces:interfaces/interface={name}/openconfig-if-ethernet:ethernet/config/port-speed', name=args[0])
speed_map = {"10MBPS":"SPEED_10MB", "100MBPS":"SPEED_100MB", "1GIGE":"SPEED_1GB", "auto":"SPEED_1GB" }
if args[1] not in speed_map.keys():
print("%Error: Invalid port speed config")... | false | true |
1c3b61505602f8e0d3ede08e1930940d3e13eaf6 | 9,934 | py | Python | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | """
Metrics for scenarios
Outputs are lists of python variables amenable to JSON serialization:
e.g., bool, int, float
numpy data types and tensors generally fail to serialize
"""
import logging
import numpy as np
logger = logging.getLogger(__name__)
def categorical_accuracy(y, y_pred):
"""
Return ... | 30.472393 | 86 | 0.599859 |
import logging
import numpy as np
logger = logging.getLogger(__name__)
def categorical_accuracy(y, y_pred):
y = np.asarray(y)
y_pred = np.asarray(y_pred)
if y.ndim == 0:
y = np.array([y])
y_pred = np.array([y_pred])
if y.shape == y_pred.shape:
return [int(x) for x in list(y ... | true | true |
1c3b61d2af6ef4297abcbc41f6994d956956b8f5 | 7,048 | py | Python | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | null | null | null | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | 1 | 2022-01-15T16:34:53.000Z | 2022-01-15T16:34:53.000Z | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | null | null | null | from tkinter import *
from tkinter.colorchooser import askcolor
import sys
class SettingsWindow(Toplevel):
def __init__(self,window):
self.root_window=window
super().__init__(window)
self.title("Einstellungen")
self.get_conf()
self.make_mess_methode_menu()
... | 33.884615 | 130 | 0.610244 | from tkinter import *
from tkinter.colorchooser import askcolor
import sys
class SettingsWindow(Toplevel):
def __init__(self,window):
self.root_window=window
super().__init__(window)
self.title("Einstellungen")
self.get_conf()
self.make_mess_methode_menu()
... | true | true |
1c3b62adbe33c307499ef5ecfd5530a3a22e0a35 | 10,715 | py | Python | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 37 | 2016-09-14T20:34:42.000Z | 2022-02-15T06:47:21.000Z | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 24 | 2016-11-16T21:36:13.000Z | 2022-02-18T14:37:35.000Z | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 45 | 2016-10-13T08:41:35.000Z | 2022-03-06T02:31:23.000Z | import http.client
import logging
import math
import os
from dataclasses import dataclass
from enum import Enum
from hashlib import md5
from urllib.parse import urlparse
MAX_PAGE_SIZE = 1000
MIN_PART_SIZE = 5 * 1024 * 1024
UPLOAD_BASE_URL = 'upload.jwplayer.com'
MAX_FILE_SIZE = 25 * 1000 * 1024 * 1024
class UploadTy... | 37.996454 | 120 | 0.629585 | import http.client
import logging
import math
import os
from dataclasses import dataclass
from enum import Enum
from hashlib import md5
from urllib.parse import urlparse
MAX_PAGE_SIZE = 1000
MIN_PART_SIZE = 5 * 1024 * 1024
UPLOAD_BASE_URL = 'upload.jwplayer.com'
MAX_FILE_SIZE = 25 * 1000 * 1024 * 1024
class UploadTy... | true | true |
1c3b634299fe4ae82ea90f3fdf2e6fe6c49b7c23 | 2,257 | py | Python | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | # Copyright 2022 highstreet technologies GmbH
#
# 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 agree... | 34.19697 | 83 | 0.626052 |
from typing import Dict
from lxml import etree
from model.python.svg.svg import Svg
class ConnectionEdgePoint(Svg):
def svg_main(self) -> etree.Element:
main = etree.Element("ellipse")
main.attrib['cx'] = str(self.center_x())
main.attrib['cy'] = str(self.center_y())
... | true | true |
1c3b63a9da742d8fa84f8684ae951375394f55f9 | 1,261 | py | Python | image/drawing/drawing_pen.py | shuge/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 179 | 2015-01-08T10:21:28.000Z | 2020-03-24T07:03:04.000Z | image/drawing/drawing_pen.py | tonytony2020/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 1 | 2019-12-23T17:14:37.000Z | 2020-01-09T16:45:58.000Z | image/drawing/drawing_pen.py | shuge/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 57 | 2015-01-05T09:34:15.000Z | 2019-11-18T06:12:08.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# penstyles.py
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.setGeometry(300, 300, 280, 270)
self.setWindowTitle('penstyles')
def paintEvent(self, e):
... | 21.372881 | 65 | 0.570182 |
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.setGeometry(300, 300, 280, 270)
self.setWindowTitle('penstyles')
def paintEvent(self, e):
qp = QtGui.QPainter()
qp.begin(... | true | true |
1c3b6427f9cbf4c095ef56d602b113ff3e241190 | 2,215 | py | Python | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | """ Test for scio worker """
import json
import act.api
from act.workers import scio
def test_scio_facts(capsys) -> None: # type: ignore
""" Test for scio facts, by comparing to captue of stdout """
with open("test/scio-doc.json") as scio_doc:
doc = json.loads(scio_doc.read())
api = act.api.Act... | 48.152174 | 120 | 0.649661 | import json
import act.api
from act.workers import scio
def test_scio_facts(capsys) -> None:
with open("test/scio-doc.json") as scio_doc:
doc = json.loads(scio_doc.read())
api = act.api.Act("", None, "error")
scio.add_to_act(api, doc, output_format="str")
captured = capsys.readouterr()
... | true | true |
1c3b64562fe8d57855fda10949458856900548ac | 1,616 | py | Python | scripts/diff_incar.py | rousseab/pymatgen | ecfba4a576a21f31c222be8fd20ce2ddaa77495a | [
"MIT"
] | 1 | 2015-05-18T14:31:20.000Z | 2015-05-18T14:31:20.000Z | scripts/diff_incar.py | rousseab/pymatgen | ecfba4a576a21f31c222be8fd20ce2ddaa77495a | [
"MIT"
] | null | null | null | scripts/diff_incar.py | rousseab/pymatgen | ecfba4a576a21f31c222be8fd20ce2ddaa77495a | [
"MIT"
] | null | null | null | # coding: utf-8
#!/usr/bin/env python
"""
Created on Nov 12, 2011
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Nov 12, 2011"
import itertools
import argparse
from pymatgen.io.va... | 29.381818 | 74 | 0.628094 |
"""
Created on Nov 12, 2011
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Nov 12, 2011"
import itertools
import argparse
from pymatgen.io.vasp import Incar
from pymatgen.util.s... | false | true |
1c3b64777d39f62668262347595156cf7f937d70 | 69,565 | py | Python | aiida/orm/nodes/data/array/bands.py | HaoZeke/aiida-core | 1a4cada67fe36353326dcebfe888ebc01a6c5b7b | [
"MIT",
"BSD-3-Clause"
] | null | null | null | aiida/orm/nodes/data/array/bands.py | HaoZeke/aiida-core | 1a4cada67fe36353326dcebfe888ebc01a6c5b7b | [
"MIT",
"BSD-3-Clause"
] | 2 | 2019-03-06T11:23:42.000Z | 2020-03-09T09:34:07.000Z | aiida/orm/nodes/data/array/bands.py | lorisercole/aiida-core | 84c2098318bf234641219e55795726f99dc25a16 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 38.625763 | 128 | 0.617595 |
if (any(i[0] == fermi_energy for i in max_mins) and any(i[1] == fermi_energy for i in max_mins)):
return False, 0.
homo = max([i[0] for i in max_mins if i[0] < fermi_energy])
lumo = min([i[1] for i in max_mins if i[1] > fermi_energy])
gap = lumo - homo
i... | true | true |
1c3b649fe1c28b0257033d6e497222d0913c9d9c | 7,396 | py | Python | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | 1 | 2018-05-03T06:17:02.000Z | 2018-05-03T06:17:02.000Z | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | 8 | 2018-05-07T16:42:35.000Z | 2022-02-26T03:31:56.000Z | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | null | null | null | from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework import pagination
from .pagination import PostLimitOffsetPagination
from saleor.billpayment.models import BillPayment as... | 42.505747 | 155 | 0.631558 | from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework import pagination
from .pagination import PostLimitOffsetPagination
from saleor.billpayment.models import BillPayment as... | true | true |
1c3b64bc4bf2b7569679a67aa99de3fa72d31013 | 777 | py | Python | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from concurrent import futures
import time
import socket
import grpc
import helloworld_pb2
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='Hello, %s! Greetings from %s,' %... | 22.852941 | 116 | 0.747748 |
from concurrent import futures
import time
import socket
import grpc
import helloworld_pb2
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='Hello, %s! Greetings from %s,' % (request.name, socke... | true | true |
1c3b65ac63df0e9f4aed422b094ec0c28e1f9ece | 2,200 | py | Python | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | 7 | 2020-08-10T12:07:52.000Z | 2021-11-11T08:40:07.000Z | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | null | null | null | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | null | null | null | from itertools import repeat
import numpy as np
def DD(qubit, t, gates, pos, f=0):
seq = [('X/2', qubit)]
i = 0
for gate in gates:
gap = t * (pos[i] - pos[i - 1]) if i > 0 else t * pos[0]
seq.append((('Delay', gap), qubit))
seq.append((gate, qubit))
i += 1
gap = t * (1... | 28.205128 | 77 | 0.419545 | from itertools import repeat
import numpy as np
def DD(qubit, t, gates, pos, f=0):
seq = [('X/2', qubit)]
i = 0
for gate in gates:
gap = t * (pos[i] - pos[i - 1]) if i > 0 else t * pos[0]
seq.append((('Delay', gap), qubit))
seq.append((gate, qubit))
i += 1
gap = t * (1... | true | true |
1c3b670d4bfa60482306031762c79099ed9a9b78 | 34 | py | Python | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | null | null | null | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | 1 | 2018-03-05T12:53:57.000Z | 2018-03-05T12:53:57.000Z | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | null | null | null | """Package for classes.
"""
| 6.8 | 24 | 0.5 | true | true | |
1c3b695591253e4ad35f6585380f0a804675b030 | 9,272 | py | Python | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | """
Script for generating the dissimilarity matrix.
csv_file_or_dir: specifies a single file or path with format of csv files to be loaded. e.g: /path/iter_{}.csv or /path/iter_*.csv.
output_dir: where to save the memmap file of the dissimilarity matrix.
feature_name: specifies the column name for featu... | 50.945055 | 206 | 0.663503 | from __future__ import print_function
import argparse
import pandas as pd
import numpy as np
import glob
import time
import pathlib
from multiprocessing import Process
from .data_utils import *
def get_features(csv_files_list, feature_name, index_name, tmp_dir, process_batch_size) :
instances_per_file = []
... | true | true |
1c3b6a68ef1c98aebe02c2059f7150413d2f0201 | 1,007 | py | Python | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2019-11-04T06:52:35.000Z | 2019-11-04T06:52:35.000Z | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2021-03-26T00:26:31.000Z | 2021-03-26T00:26:31.000Z | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2019-11-04T06:52:37.000Z | 2019-11-04T06:52:37.000Z | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors
from compose.cli.formatter import ConsoleWarningFormatter
from tests import unittest
MESSAGE = 'this is the message'
def makeLogRecord(level):
return logging.LogRecord('name', level, 'p... | 27.972222 | 76 | 0.714002 | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors
from compose.cli.formatter import ConsoleWarningFormatter
from tests import unittest
MESSAGE = 'this is the message'
def makeLogRecord(level):
return logging.LogRecord('name', level, 'p... | true | true |
1c3b6b134598894e4dda51d1cfcb8e9c4e2d366b | 5,495 | py | Python | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | 2 | 2021-06-11T22:19:36.000Z | 2021-10-04T13:40:46.000Z | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | null | null | null | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | 1 | 2021-10-04T13:40:48.000Z | 2021-10-04T13:40:48.000Z | '''
ENS 208 - Introduction to IE
Function definitions for nearest neighbor, savings, and 2-opt algorithms.
'''
from pqdict import pqdict
# =============================================================================
def nearest_neighbor(nodes, origin, d):
'''
Constructs a TSP solution using the nearest neig... | 38.697183 | 107 | 0.549227 |
from pqdict import pqdict
def nearest_neighbor(nodes, origin, d):
tour = [origin]
tour_length = 0
if origin not in nodes:
nodes.append(origin)
while len(tour) < len(nodes):
dist, next_node = min((d[tour[-1]][i], i) for i in nodes if i not in tour)
... | true | true |
1c3b6b6584e3c930954aa7f29d49f01c772dead1 | 1,496 | py | Python | ch03/ch3-3-web.py | programming-book-practice/Web-Scraping-with-Python | bab8498ff9cfad923a10087053c3eda4996211ea | [
"MIT"
] | 2 | 2019-11-15T00:33:00.000Z | 2019-12-17T10:39:29.000Z | ch03/ch3-3-web.py | programming-book-practice/Web-Scraping-with-Python | bab8498ff9cfad923a10087053c3eda4996211ea | [
"MIT"
] | null | null | null | ch03/ch3-3-web.py | programming-book-practice/Web-Scraping-with-Python | bab8498ff9cfad923a10087053c3eda4996211ea | [
"MIT"
] | 1 | 2020-10-22T01:50:40.000Z | 2020-10-22T01:50:40.000Z | from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import datetime
import random
pages = set()
random.seed(datetime.datetime.now())
# 获取页面所有内链的列表
def getInternalLinks(bsObj, includeUrl):
internalLinks = []
# 找出所有以"/"开头的链接
for link in bsObj.findAll("a", href=re.compile("^(/|.*"+includeUrl+")")):
... | 33.244444 | 73 | 0.772059 | from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import datetime
import random
pages = set()
random.seed(datetime.datetime.now())
def getInternalLinks(bsObj, includeUrl):
internalLinks = []
for link in bsObj.findAll("a", href=re.compile("^(/|.*"+includeUrl+")")):
if link.attrs['href'] is not... | false | true |
1c3b6cc6e948cf2c35b9afcd882ea30243ba2ea1 | 12,313 | py | Python | cvrf_util.py | sdrees/cvrf-util | b001abc2f31939765bf6769c4cb8a88ddcab5b36 | [
"MIT"
] | 2 | 2020-07-05T10:10:54.000Z | 2021-02-22T15:41:29.000Z | cvrf_util.py | sthagen/cvrf-util | b001abc2f31939765bf6769c4cb8a88ddcab5b36 | [
"MIT"
] | null | null | null | cvrf_util.py | sthagen/cvrf-util | b001abc2f31939765bf6769c4cb8a88ddcab5b36 | [
"MIT"
] | 1 | 2019-09-26T08:00:32.000Z | 2019-09-26T08:00:32.000Z | #!/usr/bin/env python
"""
Description:
Utility to parse and validate a CSAF Common Vulnerability Reporting Framework (CVRF)
file and display user-specified fields.
For additional information about CSAF or CVRF visit:
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=csaf
Requirements:
* lxml
This tool is b... | 40.906977 | 164 | 0.647365 |
"""
Description:
Utility to parse and validate a CSAF Common Vulnerability Reporting Framework (CVRF)
file and display user-specified fields.
For additional information about CSAF or CVRF visit:
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=csaf
Requirements:
* lxml
This tool is based on the original ... | false | true |
1c3b6db6915f10b4aa96caac0847d740e301d886 | 3,611 | py | Python | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 1 | 2021-08-23T19:09:56.000Z | 2021-08-23T19:09:56.000Z | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 2 | 2021-06-01T10:02:51.000Z | 2021-06-07T07:19:14.000Z | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 1 | 2022-03-04T14:26:55.000Z | 2022-03-04T14:26:55.000Z | # !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 ... | 35.752475 | 78 | 0.61368 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class AGNewsmodelWrapper(nn.Module):
def __init__(self, model):
super(
AGNewsmodelWrapper, self
).__init__()
self.model = model
def compute_bert_outputs(
self, model_bert, embed... | true | true |
1c3b6e7d260fb2296297ff4d554f3d2741b0f933 | 207 | py | Python | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | import django.dispatch
fetch_transactions = django.dispatch.Signal(providing_args=['access_token', 'user_id'])
fetch_accounts = django.dispatch.Signal(providing_args=['access_token', 'user_id', 'item_id']) | 41.4 | 94 | 0.797101 | import django.dispatch
fetch_transactions = django.dispatch.Signal(providing_args=['access_token', 'user_id'])
fetch_accounts = django.dispatch.Signal(providing_args=['access_token', 'user_id', 'item_id']) | true | true |
1c3b6f3dec6348c1f3e5a4afd8ab545d45f2c423 | 945 | py | Python | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | # Generated by Django 2.2.8 on 2020-04-22 14:14
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('implant', '0005_auto_20200421_1743'),
]
operations = [
migrations.AlterField(
model_name='historicalrecord',
... | 27 | 64 | 0.574603 |
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('implant', '0005_auto_20200421_1743'),
]
operations = [
migrations.AlterField(
model_name='historicalrecord',
name='time_from',
field=mo... | true | true |
1c3b6fb390c84f75c083897c59cc206166c7975c | 271 | py | Python | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | from django.http import HttpResponse
from .models import Message
def current_message(request):
message = Message.objects.all().last()
html = "<html><body><h1>%s</h1>.</body></html>" % message.text if message else 'Nenhuma mensagem'
return HttpResponse(html) | 33.875 | 101 | 0.715867 | from django.http import HttpResponse
from .models import Message
def current_message(request):
message = Message.objects.all().last()
html = "<html><body><h1>%s</h1>.</body></html>" % message.text if message else 'Nenhuma mensagem'
return HttpResponse(html) | true | true |
1c3b70ccf0f780ce1b5004dd03b412b1672e00d7 | 6,345 | py | Python | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | null | null | null | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | 5 | 2021-03-30T13:59:01.000Z | 2022-02-26T10:25:24.000Z | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | null | null | null | import numpy as _np
from multiprocessing import RawArray as _RawArray
from multiprocessing import Pool as _Pool
from functools import partial as _partial
from numba import njit
def nonzero(array):
index_array = _np.nonzero(array)[0]
return index_array
def inverse(mat):
return _np.ascontiguousarray(_np.l... | 36.889535 | 120 | 0.709535 | import numpy as _np
from multiprocessing import RawArray as _RawArray
from multiprocessing import Pool as _Pool
from functools import partial as _partial
from numba import njit
def nonzero(array):
index_array = _np.nonzero(array)[0]
return index_array
def inverse(mat):
return _np.ascontiguousarray(_np.l... | true | true |
1c3b71311b38054abbc680b04e743b1557f30ce3 | 3,404 | py | Python | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | # ------------------------------------------------
# output file name
# ------------------------------------------------
fout_name = "ExamplesAndTests_Wimp_reach/test_single_bkg_nu_DSNB_3"
# ------------------------------------------------
# parameter block for sample and read-out info
# -----------------------------... | 43.641026 | 143 | 0.668038 |
fout_name = "ExamplesAndTests_Wimp_reach/test_single_bkg_nu_DSNB_3"
sample_age_Myr = 1e3
sample_mass_kg = 1e-3
readout_resolution_Aa = 10.0
C238 = 1e-11
mineral_name = "Gypsum"
keep_H_tracks = False
ext_sample_age_bool = True
ext_sample_age_unc = 0.05
ext_sample_mass_bool = True
ext_samp... | true | true |
1c3b7148b68e89bd4aada1bea08d2093e8f7ae58 | 4,247 | py | Python | migration/db_init.py | cocobear/fuxi | a3916131689d82ce6b804e0993d89f755d1108ec | [
"MIT"
] | 731 | 2018-06-13T05:41:04.000Z | 2019-09-06T01:36:57.000Z | migration/db_init.py | riusksk/fuxi | fadb1136b8896fe2a0f7783627bda867d5e6fd98 | [
"MIT"
] | 16 | 2019-10-14T08:17:13.000Z | 2021-12-13T20:13:23.000Z | migration/db_init.py | riusksk/fuxi | fadb1136b8896fe2a0f7783627bda867d5e6fd98 | [
"MIT"
] | 238 | 2018-06-14T08:59:44.000Z | 2019-09-04T06:35:37.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2019/5/22
# @File : db_init.py
# @Desc : ""
#
# import os
# import re
# import subprocess
# import sys
# from fuxi.common.utils.logger import logger
# from sqlalchemy.exc import OperationalError
# from fuxi.common.utils.poc_handler ... | 43.783505 | 119 | 0.561808 |
alization failure: {}".format(e))
# sys.exit(0)
#
# if not DBXssPayloads.find_one():
# # xss payload example
# name = "get document.cookie"
# value = "var api = 'http://127.0.0.1:50020';\n" \
# "var url = document.location.href;\n" \
# ... | true | true |
1c3b7203b593306be831ad4edabfb7eedf8274fa | 13,768 | py | Python | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2017-08-30T06:46:16.000Z | 2017-08-30T06:46:16.000Z | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2019-10-22T12:16:53.000Z | 2019-10-22T12:16:53.000Z | from collections import Counter, OrderedDict
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_objects):
self.protect... | 43.159875 | 90 | 0.615122 | from collections import Counter, OrderedDict
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_objects):
self.protect... | true | true |
1c3b743681d6c6d737f3e9a733fc8a941192007f | 1,027 | py | Python | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | 3 | 2020-01-05T18:32:40.000Z | 2021-10-13T09:37:14.000Z | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | null | null | null | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | null | null | null | from typing import Union, List
from contextlib import contextmanager
import luigi
from luigi import worker
def _raise_run_exception(self, ex) -> None:
raise ex
@contextmanager
def debug_mode():
original_handle_run_exception = worker.TaskProcess._handle_run_exception
try:
worker.TaskProcess._han... | 24.452381 | 80 | 0.681597 | from typing import Union, List
from contextlib import contextmanager
import luigi
from luigi import worker
def _raise_run_exception(self, ex) -> None:
raise ex
@contextmanager
def debug_mode():
original_handle_run_exception = worker.TaskProcess._handle_run_exception
try:
worker.TaskProcess._han... | true | true |
1c3b7622f3555e2fb2980f2450b77b596627d868 | 1,347 | py | Python | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | import logging
import pytest
from ocs_ci.framework.testlib import ocs_upgrade, polarion_id
from ocs_ci.ocs.disruptive_operations import worker_node_shutdown
from ocs_ci.ocs.ocs_upgrade import run_ocs_upgrade
from ocs_ci.utility.reporting import get_polarion_id
log = logging.getLogger(__name__)
@pytest.fixture()
de... | 24.490909 | 81 | 0.756496 | import logging
import pytest
from ocs_ci.framework.testlib import ocs_upgrade, polarion_id
from ocs_ci.ocs.disruptive_operations import worker_node_shutdown
from ocs_ci.ocs.ocs_upgrade import run_ocs_upgrade
from ocs_ci.utility.reporting import get_polarion_id
log = logging.getLogger(__name__)
@pytest.fixture()
de... | true | true |
1c3b77d76c0f8b07da1c3b122d9a67855f9f7434 | 708 | py | Python | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | 2 | 2017-04-05T17:45:18.000Z | 2017-04-17T17:40:41.000Z | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | null | null | null | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | null | null | null | import os
from subprocess import Popen, PIPE
inputPath = "C:\\Projects\\icpsr\\B01"
outputPath = "C:\\Projects\\icpsr\\testFiles"
for root, dirs, files in os.walk(inputPath):
for file in files:
if file.lower().endswith(".tif"):
if file == "B01_AL_000014a.tif" or file == "B01_AL_000052a.tif":
print (file)
... | 32.181818 | 74 | 0.638418 | import os
from subprocess import Popen, PIPE
inputPath = "C:\\Projects\\icpsr\\B01"
outputPath = "C:\\Projects\\icpsr\\testFiles"
for root, dirs, files in os.walk(inputPath):
for file in files:
if file.lower().endswith(".tif"):
if file == "B01_AL_000014a.tif" or file == "B01_AL_000052a.tif":
print (file)
... | true | true |
1c3b7956b60e6d5f552449df4af31b1e83c619a5 | 657 | py | Python | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | #!/bin/python3
import os
def bitwiseAnd(n, k):
max_ab = 0
for i in range(k - 2, n):
for j in range(i + 1, n + 1):
ab = i & j
if ab == k - 1:
return ab
if max_ab < ab < k:
max_ab = ab
return max_ab
if __name__ == '__main__':
... | 21.9 | 55 | 0.506849 |
import os
def bitwiseAnd(n, k):
max_ab = 0
for i in range(k - 2, n):
for j in range(i + 1, n + 1):
ab = i & j
if ab == k - 1:
return ab
if max_ab < ab < k:
max_ab = ab
return max_ab
if __name__ == '__main__':
fptr = open(os... | true | true |
1c3b795ae3bf6fb749c30c39d971ba6597eb15a7 | 5,930 | py | Python | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "gbmumumu"
from pathlib import Path
from collections import OrderedDict
from tqdm import tqdm
import re
import shutil
import zipfile
from xml.dom.minidom import parse
class XlsxImages:
def __init__(self, filepath, image_idx=1, symbol_id... | 42.357143 | 93 | 0.580776 |
__author__ = "gbmumumu"
from pathlib import Path
from collections import OrderedDict
from tqdm import tqdm
import re
import shutil
import zipfile
from xml.dom.minidom import parse
class XlsxImages:
def __init__(self, filepath, image_idx=1, symbol_idx=2,
work_space=Path("./data... | true | true |
1c3b79e941fe8b8ccfe9f77d3ce7e5217f14e8bf | 5,464 | py | Python | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 42.6875 | 99 | 0.657577 |
import base64
import json
import traceback
import zlib
import six
from c7n_mailer.azure.sendgrid_delivery import SendGridDelivery
from c7n_mailer.smtp_delivery import SmtpDelivery
try:
from c7n_azure.storage_utils import StorageUtilities
from c7n_azure.session import Session
except ImportError:
... | true | true |
1c3b7a05f023cb371773f817497d23cb6e0825a0 | 21,308 | py | Python | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 35.632107 | 91 | 0.544678 |
import errno
import logging
import multiprocessing
import os
import platform
import re
import signal
import subprocess
import sys
import tempfile
import time
measure_cpu_costs = False
_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count()
# Only last N bytes of stdout will be kept if the actual output l... | true | true |
1c3b7a50f8773259f368c03788544406f1cbe60a | 2,647 | py | Python | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | from interfaces.TranscriberInterface import TranscriberInterface
import deepspeech
import numpy as np
from config import conf
import wave
from utility.Paths import path_to_base
import time
class Transcriber(TranscriberInterface):
def __init__(self):
mfp = path_to_base(conf['model_file_path'])
... | 34.376623 | 152 | 0.603702 | from interfaces.TranscriberInterface import TranscriberInterface
import deepspeech
import numpy as np
from config import conf
import wave
from utility.Paths import path_to_base
import time
class Transcriber(TranscriberInterface):
def __init__(self):
mfp = path_to_base(conf['model_file_path'])
... | true | true |
1c3b7b1f696bb4192c0fc57bc20909fded27f2d2 | 261 | py | Python | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) Benoit Bovy.
# Distributed under the terms of the Modified BSD License.
from .ipytone import Oscillator
from ._version import __version__, version_info
from .nbextension import _jupyter_nbextension_paths
| 23.727273 | 58 | 0.793103 |
from .ipytone import Oscillator
from ._version import __version__, version_info
from .nbextension import _jupyter_nbextension_paths
| true | true |
1c3b7c00bbe41313142f861234e1170e41e02c90 | 3,170 | py | Python | alphaman/strategy/__init__.py | Changsung/Backtrader | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | 5 | 2017-02-27T10:33:04.000Z | 2021-02-26T23:25:39.000Z | alphaman/strategy/__init__.py | Changsung/Alphaman | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | null | null | null | alphaman/strategy/__init__.py | Changsung/Alphaman | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (c) 2017 Changsung
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | 36.022727 | 93 | 0.752366 |
class BaseStrategy:
__signals = {}
def __init__(self):
pass
def addSignals(self, key, signal):
self.__signals[key] = signal
signal.setStrategy(self)
def getSignal(self, key):
return self.__signals[key].getSignal()
def handleData(self):
raise NotImplementedError()
def setAlpha... | true | true |
1c3b7f3815d87ef71439de3a52abe3ead37b3761 | 5,475 | py | Python | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 2 | 2019-05-23T01:31:18.000Z | 2020-06-27T21:19:10.000Z | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 6 | 2020-08-26T03:00:03.000Z | 2020-09-24T02:59:14.000Z | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 1 | 2020-05-28T12:25:15.000Z | 2020-05-28T12:25:15.000Z | import json
from collections import OrderedDict
from django.forms import Media, widgets
from django.utils.functional import cached_property
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter
from wagtail.admin.staticfiles import ve... | 33.384146 | 89 | 0.658447 | import json
from collections import OrderedDict
from django.forms import Media, widgets
from django.utils.functional import cached_property
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter
from wagtail.admin.staticfiles import ve... | true | true |
1c3b8019244656610632b52a3c5a9801cfcb4339 | 4,546 | py | Python | befh/ws_api_socket.py | philsong/BitcoinExchangeFH | 3c45d4be2ea2a258f132d982f62f69d649e0b083 | [
"Apache-2.0"
] | 32 | 2017-12-15T07:30:11.000Z | 2020-07-16T10:15:18.000Z | befh/ws_api_socket.py | bijiasuo/BitcoinExchangeFH | 9aa7b790cf74cf9fe48662147c30fc05e045e9ed | [
"Apache-2.0"
] | null | null | null | befh/ws_api_socket.py | bijiasuo/BitcoinExchangeFH | 9aa7b790cf74cf9fe48662147c30fc05e045e9ed | [
"Apache-2.0"
] | 20 | 2017-11-09T15:28:39.000Z | 2019-12-10T01:02:57.000Z | from befh.api_socket import ApiSocket
from befh.util import Logger
import websocket
import threading
import json
import time
import zlib
class WebSocketApiClient(ApiSocket):
"""
Generic REST API call
"""
def __init__(self, id, received_data_compressed=False):
"""
Constructor
:pa... | 37.570248 | 107 | 0.58205 | from befh.api_socket import ApiSocket
from befh.util import Logger
import websocket
import threading
import json
import time
import zlib
class WebSocketApiClient(ApiSocket):
def __init__(self, id, received_data_compressed=False):
ApiSocket.__init__(self)
self.ws = None
self.id... | true | true |
1c3b80e860cb6ee5de4408374e9f96e0b519ae33 | 1,299 | py | Python | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 36.083333 | 73 | 0.765204 |
from aliyunsdkcore.request import RpcRequest
class DeleteEslDeviceRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'cloudesl', '2018-08-01', 'DeleteEslDevice')
def get_EslBarCode(self):
return self.get_query_params().get('EslBarCode')
def set_EslBarCode(self,EslBarCod... | true | true |
1c3b8343aeb2606f89ad5563292263a637bd9546 | 63 | py | Python | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | import emoji
print(emoji.emojize(':mouse:', use_aliases=True))
| 21 | 49 | 0.761905 | import emoji
print(emoji.emojize(':mouse:', use_aliases=True))
| true | true |
1c3b838ce620b963a94003861d4f4eae6dadc3cf | 24,878 | py | Python | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
import numpy as np
from typing import List
from .build import BACKBONE_REGISTRY
BN_MOMENTUM = 0.01
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
... | 34.892006 | 98 | 0.518571 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
import numpy as np
from typing import List
from .build import BACKBONE_REGISTRY
BN_MOMENTUM = 0.01
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_plan... | true | true |
1c3b83b20278f57b8f3914a591d43e4033d0a48c | 2,721 | py | Python | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | """
timefhuman
===
Convert human-readable date-like string to Python datetime object.
1. Tokenize string
2. Parse possible synctatic categories: "day", "time", "time range" etc.
3. Build parse tree.
4. Use grammar to resolve lexical ambiguities.
5. Impute with default values. Output extracted datetime and/or ranges.
... | 34.884615 | 84 | 0.673282 |
from .tokenize import tokenize
from .categorize import categorize
from .tree import build_tree
from .data import Token
from .data import TimeToken
from .data import DayToken
from .data import TimeRange
from .data import DayRange
import datetime
import string
__all__ = ('timefhuman',)
def timefhuman(string, now=Non... | true | true |
1c3b8410933ea9b483807e91eb31d4a6ffe40b97 | 3,201 | py | Python | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 13 | 2020-02-09T16:03:10.000Z | 2022-03-19T14:08:16.000Z | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 3 | 2020-10-31T16:20:05.000Z | 2020-11-04T01:17:02.000Z | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 4 | 2020-12-21T22:23:16.000Z | 2022-03-29T20:25:28.000Z | import ray
from os.path import exists
# Start Ray
ray.init()
class BasePersitence:
def exists(self, key:str) -> bool:
pass
def save(self, key: str, data: dict):
pass
def restore(self, key:str) -> dict:
pass
@ray.remote
class FilePersistence(BasePersitence):
def __init__(self, ... | 32.663265 | 96 | 0.614183 | import ray
from os.path import exists
ray.init()
class BasePersitence:
def exists(self, key:str) -> bool:
pass
def save(self, key: str, data: dict):
pass
def restore(self, key:str) -> dict:
pass
@ray.remote
class FilePersistence(BasePersitence):
def __init__(self, basedir: st... | true | true |
1c3b843ec7f91fff2d89feaf4858010ee95ef60a | 3,233 | py | Python | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | 1 | 2018-03-21T13:17:19.000Z | 2018-03-21T13:17:19.000Z | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | null | null | null | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Draw(MacroElement):
"""
Vector drawing and editing plugin for Leaflet.
Examples
--------
... | 34.393617 | 111 | 0.560779 |
from __future__ import (absolute_import, division, print_function)
from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Draw(MacroElement):
def __init__(self, export=False):
super(Draw, self).__init__()
self._name = 'DrawControl'
... | true | true |
1c3b84eb2d5ed36c3f2fc4ead536712260644ef3 | 299 | py | Python | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 1,347 | 2019-08-24T19:03:50.000Z | 2022-03-29T05:44:57.000Z | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 246 | 2019-08-24T15:36:11.000Z | 2022-03-23T06:57:02.000Z | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 335 | 2019-08-25T14:54:19.000Z | 2022-03-31T23:07:18.000Z | from mmskeleton.utils import call_obj
def train(model_cfg, dataset_cfg, optimizer):
model = call_obj(**model_cfg)
dataset = call_obj(**dataset_cfg)
print('train a pseudo model...')
print('done.')
def hello_world(times=10):
for i in range(times):
print('Hello World!') | 23 | 45 | 0.672241 | from mmskeleton.utils import call_obj
def train(model_cfg, dataset_cfg, optimizer):
model = call_obj(**model_cfg)
dataset = call_obj(**dataset_cfg)
print('train a pseudo model...')
print('done.')
def hello_world(times=10):
for i in range(times):
print('Hello World!') | true | true |
1c3b8633a843a25773f6810027fdabf38915b85d | 586 | py | Python | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class TickformatstopdefaultsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickformatstopdefaults", parent_name="layout.xaxis", **kwargs
):
super(TickformatstopdefaultsValidator, self).__init__(
plotly... | 30.842105 | 88 | 0.622867 | import _plotly_utils.basevalidators
class TickformatstopdefaultsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickformatstopdefaults", parent_name="layout.xaxis", **kwargs
):
super(TickformatstopdefaultsValidator, self).__init__(
plotly... | true | true |
1c3b86740c517e4f6755d8a7dbc0f587b2e92e38 | 13,302 | py | Python | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | 45.71134 | 96 | 0.663058 |
from pymongo import MongoClient
from st2tests.base import CleanDbTestCase
from st2common.services import rbac as rbac_services
from st2common.rbac.types import PermissionType
from st2common.rbac.types import ResourceType
from st2common.rbac.types import SystemRole
from st2common.persistence.auth import ... | true | true |
1c3b86cb68dcaaca9099f389c9967fc9bd8c8253 | 61 | py | Python | python/testData/refactoring/makeFunctionTopLevel/methodOverriddenSelf.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/refactoring/makeFunctionTopLevel/methodOverriddenSelf.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/refactoring/makeFunctionTopLevel/methodOverriddenSelf.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | class C:
def me<caret>thod(self):
self = object() | 20.333333 | 28 | 0.557377 | class C:
def me<caret>thod(self):
self = object() | false | true |
1c3b882a637f80a50713d18dbe29569837195b4d | 6,860 | py | Python | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | from typing import Union
from item import ItemFinder
from template_finder import TemplateFinder
from config import Config
from pather import Location
from logger import Logger
from ui import UiManager
from town import IAct, A3, A4, A5
from utils.misc import wait
class TownManager:
def __init__(self, template_find... | 43.974359 | 117 | 0.675802 | from typing import Union
from item import ItemFinder
from template_finder import TemplateFinder
from config import Config
from pather import Location
from logger import Logger
from ui import UiManager
from town import IAct, A3, A4, A5
from utils.misc import wait
class TownManager:
def __init__(self, template_find... | true | true |
1c3b883d40ecbfa89fe733e7e5f4064d03109ce2 | 17,794 | py | Python | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2018-08-15T01:28:13.000Z | 2018-08-15T01:28:13.000Z | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2019-12-15T06:51:21.000Z | 2019-12-15T06:51:21.000Z | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2020-12-16T06:33:59.000Z | 2020-12-16T06:33:59.000Z | # Lint as: python2, python3
# 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
#
... | 38.184549 | 80 | 0.70417 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import re
import sys
import six
import tensorflow as tf
from google.protobuf import message
from google.protobuf import text_format
from tensorflow.python.lib.io im... | true | true |
1c3b884e735121a071a27e02fa0a5822a54cc9b7 | 986 | py | Python | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | null | null | null | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | 3 | 2021-06-08T20:49:09.000Z | 2022-03-12T00:11:37.000Z | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | null | null | null | import os
import secrets
from PIL import Image
from flask import url_for, current_app
from flask_mail import Message
from app import mail
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
picture_fn = random_hex + f_ext
picture_path = ... | 31.806452 | 91 | 0.710953 | import os
import secrets
from PIL import Image
from flask import url_for, current_app
from flask_mail import Message
from app import mail
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
picture_fn = random_hex + f_ext
picture_path = ... | true | true |
1c3b88c9aac619ae987c9d5fcf65026bf68d19ee | 1,355 | py | Python | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 37 | 2018-04-16T20:18:25.000Z | 2022-03-06T09:06:12.000Z | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 162 | 2018-04-18T12:17:53.000Z | 2022-03-09T11:07:36.000Z | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 12 | 2018-04-11T11:56:22.000Z | 2021-02-12T15:12:13.000Z | import os
import shutil
from test.base import TestCase, main, assets
from ocrd import Resolver
from ocrd_tesserocr import TesserocrSegmentRegion
from ocrd_tesserocr import TesserocrSegmentLine
from ocrd_tesserocr import TesserocrSegmentWord
#METS_HEROLD_SMALL = assets.url_of('SBB0000F29300010000/mets_one_file.xml')
... | 30.111111 | 89 | 0.684871 | import os
import shutil
from test.base import TestCase, main, assets
from ocrd import Resolver
from ocrd_tesserocr import TesserocrSegmentRegion
from ocrd_tesserocr import TesserocrSegmentLine
from ocrd_tesserocr import TesserocrSegmentWord
METS_HEROLD_SMALL = assets.url_of('kant_aufklaerung_1784-binarized/data/met... | true | true |
1c3b89ac20e89e529baf47b178aa860d90f2e7ed | 3,901 | py | Python | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | null | null | null | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | 2 | 2018-10-25T13:04:01.000Z | 2019-08-17T13:15:24.000Z | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | 2 | 2018-10-17T13:32:50.000Z | 2018-11-08T08:39:39.000Z | # Copyright 2011 OpenStack Foundation
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | 41.946237 | 78 | 0.616765 |
from cinder.api import extensions
import cinder.api.openstack
from cinder.api.v1 import snapshots
from cinder.api.v1 import volumes
from cinder.api.v2 import limits
from cinder.api.v2 import snapshot_metadata
from cinder.api.v2 import types
from cinder.api.v2 import volume_metadata
from cinder.api imp... | true | true |
1c3b8a6a66224b1070bb699a4bf3678c4a18043d | 4,090 | py | Python | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | import os, sys, platform
from os.path import join, dirname, abspath, basename, isdir
import unittest
def add_to_path(library):
"""
Prepends the build directory to the path so that newly built pyodbc or pyiodbc libraries
are used, allowing it to be tested without installing it.
* library: The ... | 34.661017 | 117 | 0.610269 | import os, sys, platform
from os.path import join, dirname, abspath, basename, isdir
import unittest
def add_to_path(library):
import imp
library_exts = [ t[0] for t in imp.get_suffixes() if t[-1] == imp.C_EXTENSION ]
library_names = [ '%s%s' % (library, ext) for ext in library_e... | true | true |
1c3b8c1a040c940ae6e79c7eb41f1a4ba4854214 | 16,712 | py | Python | src/Nvidia-StyleGAN/results/00013-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | 1 | 2022-03-09T07:40:31.000Z | 2022-03-09T07:40:31.000Z | src/Nvidia-StyleGAN/results/00014-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | null | null | null | src/Nvidia-StyleGAN/results/00014-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | 2 | 2021-07-02T20:16:05.000Z | 2022-03-09T07:40:39.000Z | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 86.14433 | 302 | 0.622487 |
import copy
import dnnlib
from dnnlib import EasyDict
import config
from metrics import metric_base
if 1:
desc = 'sgan'
train = EasyDict(run_func_name='training.training_loop.training_loop')
G ... | true | true |
1c3b8ca5afcb581835c8a7ef7d06ea1ed3df160d | 539 | py | Python | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | null | null | null | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | 169 | 2020-04-08T08:34:17.000Z | 2022-03-31T12:25:30.000Z | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | 1 | 2020-10-26T15:50:56.000Z | 2020-10-26T15:50:56.000Z | from .consent_codes import CONSENT_CODES
from .variant_constants import CHROMOSOMES
from .query_errors import (
NO_MANDATORY_PARAMS,
NO_SECONDARY_PARAMS,
NO_POSITION_PARAMS,
INVALID_COORDINATES,
BUILD_MISMATCH,
)
from .oauth_errors import (
MISSING_PUBLIC_KEY,
MISSING_TOKEN_CLAIMS,
INVAL... | 25.666667 | 55 | 0.795918 | from .consent_codes import CONSENT_CODES
from .variant_constants import CHROMOSOMES
from .query_errors import (
NO_MANDATORY_PARAMS,
NO_SECONDARY_PARAMS,
NO_POSITION_PARAMS,
INVALID_COORDINATES,
BUILD_MISMATCH,
)
from .oauth_errors import (
MISSING_PUBLIC_KEY,
MISSING_TOKEN_CLAIMS,
INVAL... | true | true |
1c3b8d49c184ec6f47976fcb0921813004ec198e | 5,294 | py | Python | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | """
Init the ethereum private chain. This script should be run only once for each unique private chain.
This script is for administrator, as it will deploy the factory contract to the chain.
Chain initialization for end user is run when the server starts.
You need to have `geth` in PATH.
This script may not work on win... | 41.359375 | 125 | 0.635436 | import argparse
import getpass
import json
import os
import subprocess
from pathlib import Path
import time
from web3 import Web3, IPCProvider
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[... | true | true |
1c3b8e5da1c72d325d541aeb4ff0e38fc1ef4c49 | 1,278 | py | Python | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version 1.0 ... | 37.588235 | 73 | 0.241002 | true | true | |
1c3b8f17dd7de87e6422c0c380a155afbb757940 | 943 | py | Python | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | import paramiko
from paramiko.ssh_exception import AuthenticationException
"""
transport模式
"""
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
# 1、密码连接
ssh.connect(hostname='192.168.174.23', username='root', password='123.com')
# 2、秘钥连接
# pkey = RSAKey.from_p... | 24.179487 | 79 | 0.630965 | import paramiko
from paramiko.ssh_exception import AuthenticationException
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(hostname='192.168.174.23', username='root', password='123.com')
while True:
cli = ssh.get_trans... | true | true |
1c3b90aabb486e78ca185ec99144aefce7e93bab | 2,351 | py | Python | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | # -*- 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 o... | 32.652778 | 78 | 0.682263 |
import abc
import typing
from google import auth
from google.auth import credentials
from google.cloud.mediatranslation_v1beta1.types import media_translation
class SpeechTranslationServiceTransport(metaclass=abc.ABCMeta):
AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
... | true | true |
1c3b911492a60c6d7276ed012bdfeccdc209cf10 | 21,229 | py | Python | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | 1 | 2022-03-02T17:07:20.000Z | 2022-03-02T17:07:20.000Z | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/RealTime_6DOF_Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | null | null | null | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/RealTime_6DOF_Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | null | null | null | """Image-handling routines
### Unresolved:
Following methods are not yet resolved due to my not being sure how the
function should be wrapped:
glCompressedTexImage3D
glCompressedTexImage2D
glCompressedTexImage1D
glCompressedTexSubImage3D
glCompressedTexSubImage2D
... | 34.801639 | 103 | 0.68218 | from OpenGL.raw import GL as simple
from OpenGL import images, arrays, wrapper, platform
import ctypes
def asInt( value ):
if isinstance( value, float ):
return int(round(value,0))
return value
_LUMINANCE : 1,
simple.GL_LUMINANCE_ALPHA : 2,
simple.GL_COLOR_INDEX : 1,
simple.GL_STENCIL_INDE... | true | true |
1c3b911fd355be54f104f5f1f71cbc02840658dd | 40,479 | py | Python | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | 1 | 2020-07-24T09:44:17.000Z | 2020-07-24T09:44:17.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 45.635851 | 79 | 0.618148 |
import time
import mox
from oslo.config import cfg
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova.conductor import rpcapi as conductor_rpcapi
from nova import context
from nova import d... | true | true |
1c3b91be38d7610a2ed63edb3407d29e0df7c1fa | 2,801 | py | Python | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | import os, sys
import logging
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../")))
from v2.lib.nfs_ganesha.write_io_info import IOInfo
import v2.utils.utils as utils
import v2.lib.manage_data as manage_date
log = logging.getLogger()
dir_info = {'basedir': 0,
'files': 10,
'subd... | 26.67619 | 92 | 0.49875 | import os, sys
import logging
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../")))
from v2.lib.nfs_ganesha.write_io_info import IOInfo
import v2.utils.utils as utils
import v2.lib.manage_data as manage_date
log = logging.getLogger()
dir_info = {'basedir': 0,
'files': 10,
'subd... | true | true |
1c3b93a07647ff7f7f0a8577a0848b269271d644 | 3,507 | py | Python | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | # -*- coding: utf-8 -*-
###############################################################################
#
# EcoByZip
# Returns a host of eco-conscious environmental information for a specified location based on zip code.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache Li... | 37.709677 | 194 | 0.682635 | true | true | |
1c3b93e3b4d64425f75c0f00fe5ccfbefb2f3147 | 43 | py | Python | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 6,931 | 2015-01-01T11:41:55.000Z | 2022-03-31T17:03:24.000Z | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 6,137 | 2015-01-01T00:33:45.000Z | 2022-03-31T22:53:17.000Z | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 2,608 | 2015-01-02T21:32:31.000Z | 2022-03-31T07:38:30.000Z | from var_plots import plot_irf
plot_irf()
| 10.75 | 30 | 0.813953 | from var_plots import plot_irf
plot_irf()
| true | true |
1c3b953f96fe6a07f40d66ce24e0c53ff7627cbb | 687 | py | Python | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | null | null | null | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | 1 | 2020-02-11T23:41:38.000Z | 2020-02-11T23:41:38.000Z | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.test import TestCase
from mongoengine import ValidationError
from timberjack.validators import validate_ip_address
class ValidateIPAddressTestCase(TestCase):
def test_validate_valid_ip_address(self):
values = ['127.0.0.1', '1.1.1.1', '255.0.0.0', '0.0.0.0', 'fe80::1',... | 36.157895 | 102 | 0.646288 |
from django.test import TestCase
from mongoengine import ValidationError
from timberjack.validators import validate_ip_address
class ValidateIPAddressTestCase(TestCase):
def test_validate_valid_ip_address(self):
values = ['127.0.0.1', '1.1.1.1', '255.0.0.0', '0.0.0.0', 'fe80::1', '::1', '1:2:3:4:5:6:7:... | true | true |
1c3b9569eb9997c66926e02d8ea3de077756c3c3 | 976 | py | Python | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 22 | 2017-04-24T10:00:45.000Z | 2021-04-01T10:11:05.000Z | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 12 | 2017-03-26T18:34:21.000Z | 2019-03-21T19:13:03.000Z | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 7 | 2017-10-14T13:33:33.000Z | 2021-03-18T15:18:50.000Z | import sys
char_ = None
def readchar_():
global char_
if char_ == None:
char_ = sys.stdin.read(1)
return char_
def skipchar():
global char_
char_ = None
return
def stdinsep():
while True:
c = readchar_()
if c == '\n' or c == '\t' or c == '\r' or c == ' ':
... | 16.827586 | 59 | 0.445697 | import sys
char_ = None
def readchar_():
global char_
if char_ == None:
char_ = sys.stdin.read(1)
return char_
def skipchar():
global char_
char_ = None
return
def stdinsep():
while True:
c = readchar_()
if c == '\n' or c == '\t' or c == '\r' or c == ' ':
... | true | true |
1c3b962c436cc4031f7d176f27436338c96a5f33 | 109 | py | Python | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | """This package provides objects for interfacing with potentiometers."""
__all__ = (
"potentiometer"
)
| 15.571429 | 72 | 0.715596 |
__all__ = (
"potentiometer"
)
| true | true |
1c3b969f3970cd9cd64fcb8ab6a8f3889957e301 | 13,060 | py | Python | Utils/request_contributor_review.py | ryantoddtq/content | 50027658da7189e37e9514fc03057d1c1bc3209f | [
"MIT"
] | 2 | 2020-07-27T10:35:41.000Z | 2020-12-14T15:44:18.000Z | Utils/request_contributor_review.py | Axonius/content | e058add82b7422338015cf14591512b9aad4d3e9 | [
"MIT"
] | 30 | 2022-03-16T14:07:34.000Z | 2022-03-31T17:37:51.000Z | Utils/request_contributor_review.py | Axonius/content | e058add82b7422338015cf14591512b9aad4d3e9 | [
"MIT"
] | 1 | 2022-01-23T17:30:09.000Z | 2022-01-23T17:30:09.000Z | import argparse
import requests
import os
import sys
from pathlib import Path
import json
import sendgrid
from sendgrid.helpers.mail import *
REPO_OWNER = "demisto"
REPO_NAME = "content"
PACKS_FOLDER = "Packs"
CONTENT_REPO_FULL_PATH = os.environ.get('GITHUB_WORKSPACE') or os.path.abspath(
os.path.join(__file__, '.... | 44.121622 | 120 | 0.638515 | import argparse
import requests
import os
import sys
from pathlib import Path
import json
import sendgrid
from sendgrid.helpers.mail import *
REPO_OWNER = "demisto"
REPO_NAME = "content"
PACKS_FOLDER = "Packs"
CONTENT_REPO_FULL_PATH = os.environ.get('GITHUB_WORKSPACE') or os.path.abspath(
os.path.join(__file__, '.... | true | true |
1c3b9740aebd671c6731655fdc43f882dd7cb058 | 785 | py | Python | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | # 5. Реализовать структуру «Рейтинг», представляющую собой не возрастающий набор натуральных чисел. У пользователя
# необходимо запрашивать новый элемент рейтинга. Если в рейтинге существуют элементы с одинаковыми значениями,
# то новый элемент с тем же значением должен разместиться после них.
rating_list = [7, 5, 3, ... | 37.380952 | 114 | 0.743949 |
rating_list = [7, 5, 3, 3, 2]
rating_len = len(rating_list)
new_elem = input("Введите новый элемент рейтинга: ")
while (not new_elem.isdecimal()) or int(new_elem) == 0:
new_elem = input("Нужно ввести натуральное число! ")
new_elem = int(new_elem)
for index, elem in enumerate(rating_list[::-1]):
if elem >=... | true | true |
1c3b974fc9bd283a772dd33492c5eb9514f396f6 | 1,202 | py | Python | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | ## -*- coding: UTF-8 -*-
## __init__.py
##
## Copyright (c) 2018 analyzeDFIR
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the right... | 48.08 | 81 | 0.755408 | true | true | |
1c3b97ea948b3cc9bdf4f68081771744c74425a3 | 609 | py | Python | esercizi/bisezione.py | gdv/python-alfabetizzazione | d87561222de8a230db11d8529c49cf1702aec326 | [
"MIT"
] | null | null | null | esercizi/bisezione.py | gdv/python-alfabetizzazione | d87561222de8a230db11d8529c49cf1702aec326 | [
"MIT"
] | null | null | null | esercizi/bisezione.py | gdv/python-alfabetizzazione | d87561222de8a230db11d8529c49cf1702aec326 | [
"MIT"
] | 1 | 2019-03-26T11:14:33.000Z | 2019-03-26T11:14:33.000Z | ITERAZIONI = 100
# def effe(x):
# y = - x + 2.0
# return y
def effe(x):
y = x**3 - 13 * x**2 + 19 * x + 33
return y
# listaPunti[0] = Xmin
# listaPunti[1] = Xmid
# listaPunti[2] = Xmax
def intervallo(listaPunti):
if(effe(listaPunti[0]) * effe(listaPunti[1]) <= 0):
listaPunti[2] = listaPun... | 19.03125 | 57 | 0.551724 | ITERAZIONI = 100
def effe(x):
y = x**3 - 13 * x**2 + 19 * x + 33
return y
def intervallo(listaPunti):
if(effe(listaPunti[0]) * effe(listaPunti[1]) <= 0):
listaPunti[2] = listaPunti[1]
else:
listaPunti[0] = listaPunti[1]
listaPunti[1] = 0.5 * (listaPunti[0] + listaPunti[2... | false | true |
1c3b98dc295b3ff99d75165f474884a35f9f607a | 4,153 | py | Python | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | 3 | 2020-03-02T05:00:38.000Z | 2021-12-19T08:46:32.000Z | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | null | null | null | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | 1 | 2020-12-04T09:34:50.000Z | 2020-12-04T09:34:50.000Z | import torch
import math
import torch.nn.init
import torch.nn as nn
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import numpy as np
import torch.nn.functional as F
from Utils import L2Norm
def getPoolingKernel(kernel_size = 25):
step = 1. / float(np.floor( kernel_size / 2.))
x_coef ... | 41.118812 | 129 | 0.601974 | import torch
import math
import torch.nn.init
import torch.nn as nn
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import numpy as np
import torch.nn.functional as F
from Utils import L2Norm
def getPoolingKernel(kernel_size = 25):
step = 1. / float(np.floor( kernel_size / 2.))
x_coef ... | true | true |
1c3b9971b39385d358dbaa6778a6751566f1fb76 | 6,699 | py | Python | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 330 | 2020-09-14T23:10:16.000Z | 2022-03-30T19:49:19.000Z | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 52 | 2020-09-30T06:10:51.000Z | 2022-03-31T19:25:16.000Z | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 119 | 2020-09-24T04:54:46.000Z | 2022-03-31T21:46:57.000Z | # Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 46.520833 | 80 | 0.753247 |
from typing import Any, Callable, Optional
import tensorflow as tf
import tensorflow_federated as tff
DEFAULT_SERVER_OPTIMIZER_FN = lambda: tf.keras.optimizers.SGD(learning_rate=1.0)
def build_keras_output_to_loss_fn(
metric_builder=Callable[[], tf.keras.metrics.Metric]):
def output_to_loss_fn(... | true | true |
1c3b9a147a8ab5ee9b8b9425ba2e1e83038eb05c | 59 | py | Python | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 5 | 2021-10-30T05:10:42.000Z | 2022-03-26T08:44:17.000Z | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 2 | 2021-12-20T08:52:50.000Z | 2021-12-28T15:14:48.000Z | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 1 | 2022-02-01T11:02:40.000Z | 2022-02-01T11:02:40.000Z | from . import datasets, losses
from .models import DetConB
| 19.666667 | 30 | 0.79661 | from . import datasets, losses
from .models import DetConB
| true | true |
1c3b9a41211bbbc44d403ed53a0a4be53c4080f8 | 580 | py | Python | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | '''
Copyright <2021> <Thomas Chapman>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM... | 41.428571 | 118 | 0.768966 |
import rhinoscriptsyntax as rs
rs.Command("_setview _w _p")
| true | true |
1c3b9b2da3dc917c8474a8fa1acb20b854120495 | 490 | py | Python | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-01-26 21:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item'... | 21.304348 | 114 | 0.597959 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(auto_crea... | true | true |
1c3b9d7214b7179f554910b926d12afb4f426760 | 5,455 | py | Python | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="bar", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | 48.274336 | 74 | 0.550504 | import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="bar", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | true | true |
1c3b9e7b099769d60c76419175e7191bea797836 | 84 | py | Python | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | 1 | 2016-05-08T08:14:24.000Z | 2016-05-08T08:14:24.000Z | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | null | null | null | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | 2 | 2015-12-03T07:01:44.000Z | 2021-04-21T07:35:38.000Z | __doc__ = """DICOM I/O Library."""
package = {'downloadLocation':'dcmtk-3.5.4.zip'}
| 28 | 48 | 0.654762 | __doc__ = """DICOM I/O Library."""
package = {'downloadLocation':'dcmtk-3.5.4.zip'}
| true | true |
1c3b9f822f1d9ee2e3cbc112b2fa63b155dfefc4 | 4,979 | py | Python | run_others/en_fr/test_ITransE_lan_mapping_120k_fk.py | muhaochen/MTransE | 96d17a266c97831a1c7e854320b222605fb9547c | [
"Apache-2.0"
] | 70 | 2017-07-28T15:28:14.000Z | 2021-12-29T10:28:38.000Z | run_others/en_fr/test_ITransE_lan_mapping_120k_fk.py | muhaochen/MTransE | 96d17a266c97831a1c7e854320b222605fb9547c | [
"Apache-2.0"
] | null | null | null | run_others/en_fr/test_ITransE_lan_mapping_120k_fk.py | muhaochen/MTransE | 96d17a266c97831a1c7e854320b222605fb9547c | [
"Apache-2.0"
] | 18 | 2017-07-30T06:59:04.000Z | 2021-03-26T03:19:56.000Z | import sys
import os
new_path = os.path.join(os.path.dirname(__file__), '../../src/ITransE')
sys.path.append(new_path)
from ITransE import ITransE
import time
import multiprocessing
from multiprocessing import Process, Value, Lock, Manager, Array
import numpy as np
from numpy import linalg as LA
fmap = os... | 30.734568 | 132 | 0.559952 | import sys
import os
new_path = os.path.join(os.path.dirname(__file__), '../../src/ITransE')
sys.path.append(new_path)
from ITransE import ITransE
import time
import multiprocessing
from multiprocessing import Process, Value, Lock, Manager, Array
import numpy as np
from numpy import linalg as LA
fmap = os... | false | true |
1c3ba0254b9dd006118668e7ac0f5ea277646eb6 | 2,189 | py | Python | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 92 | 2015-01-21T06:25:18.000Z | 2022-02-23T22:29:05.000Z | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 17 | 2015-04-30T21:02:05.000Z | 2021-03-09T17:30:00.000Z | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 13 | 2015-04-30T20:54:36.000Z | 2022-02-12T17:06:15.000Z | # -*- coding: utf-8 -*-
import six
from importlib import import_module
def import_by_path(dotted_path):
"""Import a dotted module path and return the attribute/class designated
by the last name in the path. Raise ImportError if the import failed.
Adapted from Django 1.7
"""
try:
if not d... | 25.16092 | 79 | 0.638191 |
import six
from importlib import import_module
def import_by_path(dotted_path):
try:
if not dotted_path.count('.'):
dotted_path = '.'.join(['__main__', dotted_path])
module_path, class_name = dotted_path.rsplit('.', 1)
except ValueError:
msg = '"{}" doesn\'t look like a ... | true | true |
1c3ba176fbd1c0dd6f9f2e8c9fd3ac6065d5c80f | 8,368 | py | Python | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | 1 | 2019-05-11T22:40:48.000Z | 2019-05-11T22:40:48.000Z | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | null | null | null | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | null | null | null | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2011 OpenStack Foundation
# (c) Cop... | 35.012552 | 78 | 0.573136 |
from oslo.config import cfg
import six
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LW
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import units
from nova.virt.libvi... | true | true |
1c3ba1c6237da82256774388a9e211c332d00c98 | 1,843 | py | Python | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import asyncio
import time
from poke_env.player.player import Player
from poke_env.player.random_player import RandomPlayer
class MaxDamagePlayer(Player):
def choose_move(self, battle):
# If the player can attack, it will
if battle.available_moves:
... | 34.12963 | 86 | 0.655453 |
import asyncio
import time
from poke_env.player.player import Player
from poke_env.player.random_player import RandomPlayer
class MaxDamagePlayer(Player):
def choose_move(self, battle):
if battle.available_moves:
best_move = max(battle.available_moves, key=lam... | true | true |
1c3ba2386427f1f11255eabaa7bd9f3ff079e2ff | 604 | py | Python | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | import spacy
nlp = spacy.blank("fr")
# Importe les classes Doc et Span
from spacy.tokens import Doc, Span
words = ["Elle", "aime", "David", "Bowie"]
spaces = [True, True, True, False]
# Crée un doc à partir des mots et des espaces
doc = Doc(nlp.vocab, words=words, spaces=spaces)
print(doc.text)
# Crée un span pour... | 24.16 | 51 | 0.698675 | import spacy
nlp = spacy.blank("fr")
from spacy.tokens import Doc, Span
words = ["Elle", "aime", "David", "Bowie"]
spaces = [True, True, True, False]
doc = Doc(nlp.vocab, words=words, spaces=spaces)
print(doc.text)
span = Span(doc, 2, 4, label="PER")
print(span.text, span.label_)
doc.ents = [span]
print([(... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.