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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f76c697fcb08f285d94af1b29f8c0261afea95c8 | 2,522 | py | Python | pgdrive/world/manual_controller.py | 1155107756/pgdrive | 708375c8cb6c5ed1950c20d91bd0aec5fd1b1e62 | [
"Apache-2.0"
] | null | null | null | pgdrive/world/manual_controller.py | 1155107756/pgdrive | 708375c8cb6c5ed1950c20d91bd0aec5fd1b1e62 | [
"Apache-2.0"
] | null | null | null | pgdrive/world/manual_controller.py | 1155107756/pgdrive | 708375c8cb6c5ed1950c20d91bd0aec5fd1b1e62 | [
"Apache-2.0"
] | null | null | null | from direct.controls.InputState import InputState
from pgdrive.utils import import_pygame
from pgdrive.world.pg_world import PGWorld
pygame = import_pygame()
class Controller:
def process_input(self):
raise NotImplementedError
class KeyboardController(Controller):
INCREMENT = 2e-1
def __init_... | 34.547945 | 95 | 0.601507 | from direct.controls.InputState import InputState
from pgdrive.utils import import_pygame
from pgdrive.world.pg_world import PGWorld
pygame = import_pygame()
class Controller:
def process_input(self):
raise NotImplementedError
class KeyboardController(Controller):
INCREMENT = 2e-1
def __init_... | true | true |
f76c69c19dd3bbac5a0c3385a46ef324d9d21498 | 385 | py | Python | docker_cookiecutter/cookiecutters.py | tausten/docker-cookiecutter | c9361f91538e291fe2813075f35dc3718b8fbcac | [
"MIT"
] | null | null | null | docker_cookiecutter/cookiecutters.py | tausten/docker-cookiecutter | c9361f91538e291fe2813075f35dc3718b8fbcac | [
"MIT"
] | 9 | 2021-09-04T01:12:18.000Z | 2021-11-14T23:36:45.000Z | docker_cookiecutter/cookiecutters.py | tausten-org/docker-cookiecutter | c9361f91538e291fe2813075f35dc3718b8fbcac | [
"MIT"
] | null | null | null | from cookiecutter.main import cookiecutter
from docker_cookiecutter.templates import decode_template_sources
# TODO: Actually implement this.. right now, this is mostly a stub
def cookiecutters(templates: str) -> "list[str]":
sources = decode_template_sources(templates)
result = []
for t in sources:
... | 25.666667 | 67 | 0.745455 | from cookiecutter.main import cookiecutter
from docker_cookiecutter.templates import decode_template_sources
def cookiecutters(templates: str) -> "list[str]":
sources = decode_template_sources(templates)
result = []
for t in sources:
result.append(cookiecutter(t.template))
return result
| true | true |
f76c6ac15cab8a5d994cdd52396db93e92dee644 | 3,028 | py | Python | transformers/executables/pe_imports_features.py | james94/driverlessai-recipes | 87c35460db59ffda8dc18ad82cb3a9b8291410e4 | [
"Apache-2.0"
] | null | null | null | transformers/executables/pe_imports_features.py | james94/driverlessai-recipes | 87c35460db59ffda8dc18ad82cb3a9b8291410e4 | [
"Apache-2.0"
] | null | null | null | transformers/executables/pe_imports_features.py | james94/driverlessai-recipes | 87c35460db59ffda8dc18ad82cb3a9b8291410e4 | [
"Apache-2.0"
] | null | null | null | """Extract LIEF features from PE files"""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
class PEImportsFeatures(CustomTransformer):
_modules_needed_by_name = ['lief==0.9.0']
_regression = True
_binary = True
_multiclass = True
_is_reproducible ... | 35.623529 | 114 | 0.622853 | from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
class PEImportsFeatures(CustomTransformer):
_modules_needed_by_name = ['lief==0.9.0']
_regression = True
_binary = True
_multiclass = True
_is_reproducible = True
_parallel_task = True _can... | true | true |
f76c6bd867d85b2a3a677e52eee792217c326993 | 395 | py | Python | sets/1/challenges/s1c4.py | aawc/cryptopals | 2521cb2455ce3359551ed0d9198ea4c35ca84642 | [
"MIT"
] | null | null | null | sets/1/challenges/s1c4.py | aawc/cryptopals | 2521cb2455ce3359551ed0d9198ea4c35ca84642 | [
"MIT"
] | null | null | null | sets/1/challenges/s1c4.py | aawc/cryptopals | 2521cb2455ce3359551ed0d9198ea4c35ca84642 | [
"MIT"
] | null | null | null | from common import score_and_decode as sad
from common import read_lines
def SingleCharacterXOR(f):
decoded = [sad.ScoreAndDecode(line)[1] for line in read_lines.ReadLines(f)]
scores = [sad.EnglishLikeScore(l) for l in decoded]
max_index = scores.index(max(scores))
return max_index, scores[max_index], decoded[... | 32.916667 | 77 | 0.764557 | from common import score_and_decode as sad
from common import read_lines
def SingleCharacterXOR(f):
decoded = [sad.ScoreAndDecode(line)[1] for line in read_lines.ReadLines(f)]
scores = [sad.EnglishLikeScore(l) for l in decoded]
max_index = scores.index(max(scores))
return max_index, scores[max_index], decoded[... | false | true |
f76c6d32ce74a15c42108b913807bccef4e5c7cc | 727 | py | Python | gimmemotifs/__init__.py | littleblackfish/gimmemotifs | 913a6e5db378493155273e2c0f8ab0dc11ab219e | [
"MIT"
] | null | null | null | gimmemotifs/__init__.py | littleblackfish/gimmemotifs | 913a6e5db378493155273e2c0f8ab0dc11ab219e | [
"MIT"
] | null | null | null | gimmemotifs/__init__.py | littleblackfish/gimmemotifs | 913a6e5db378493155273e2c0f8ab0dc11ab219e | [
"MIT"
] | null | null | null | import atexit
from os import getpid
import shutil
from tempfile import mkdtemp
import logging
def mytmpdir():
if not hasattr(mytmpdir, 'dir') or not mytmpdir.dir:
mytmpdir.dir = mkdtemp(prefix="gimmemotifs.{0}.".format(getpid()))
atexit.register(shutil.rmtree, mytmpdir.dir)
return mytmpdir.dir
... | 25.068966 | 81 | 0.751032 | import atexit
from os import getpid
import shutil
from tempfile import mkdtemp
import logging
def mytmpdir():
if not hasattr(mytmpdir, 'dir') or not mytmpdir.dir:
mytmpdir.dir = mkdtemp(prefix="gimmemotifs.{0}.".format(getpid()))
atexit.register(shutil.rmtree, mytmpdir.dir)
return mytmpdir.dir
... | true | true |
f76c6d8b7b995bf3c6629c0668c7e9aca4df0301 | 493 | py | Python | flaskapp/models/__init__.py | tomoncle/flaskapp | db37b4ae9b5447e4e7d1f789322cd5dc2e95761f | [
"MIT"
] | 54 | 2018-07-10T15:39:03.000Z | 2022-03-28T03:24:27.000Z | flaskapp/models/__init__.py | tomoncle/flaskapp | db37b4ae9b5447e4e7d1f789322cd5dc2e95761f | [
"MIT"
] | 1 | 2019-07-22T01:22:14.000Z | 2019-07-22T01:22:14.000Z | flaskapp/models/__init__.py | tomoncle/flaskapp | db37b4ae9b5447e4e7d1f789322cd5dc2e95761f | [
"MIT"
] | 27 | 2018-07-14T05:46:03.000Z | 2022-03-28T03:24:27.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18-3-28 下午5:01
# @Author : Tom.Lee
# @File : __init__.py
# @Product : PyCharm
# @Source :
from .clazz import Clazz
from .school import School
from .user import User
from ..common import ConsoleLogger, relative_path
logg... | 22.409091 | 49 | 0.63286 |
from .clazz import Clazz
from .school import School
from .user import User
from ..common import ConsoleLogger, relative_path
logger = ConsoleLogger(relative_path(__file__))
logger.info('initial app models model')
__all__ = ['User', 'Clazz', 'School']
MODELS = __all__
| true | true |
f76c6dfae5a64de5d34b0d1dd31e8bb997137f5d | 13,161 | py | Python | venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/pep425tags.py | nguidjoi/bigData | aef722e77c10b8b0261578277892ebb15764d680 | [
"Apache-2.0"
] | 1 | 2019-05-29T15:22:28.000Z | 2019-05-29T15:22:28.000Z | venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/pep425tags.py | nguidjoi/bigData | aef722e77c10b8b0261578277892ebb15764d680 | [
"Apache-2.0"
] | null | null | null | venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/pep425tags.py | nguidjoi/bigData | aef722e77c10b8b0261578277892ebb15764d680 | [
"Apache-2.0"
] | 1 | 2019-05-29T15:24:24.000Z | 2019-05-29T15:24:24.000Z | """Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import distutils.util
import logging
import platform
import re
import sys
import sysconfig
import warnings
from collections import OrderedDict
import pip._internal.utils.glibc
from pip._internal.utils.compat import get_ext... | 34.45288 | 102 | 0.594256 | from __future__ import absolute_import
import distutils.util
import logging
import platform
import re
import sys
import sysconfig
import warnings
from collections import OrderedDict
import pip._internal.utils.glibc
from pip._internal.utils.compat import get_extension_suffixes
from pip._internal.utils.typing import MY... | true | true |
f76c6e042f258489597f194e3bb87f1598fc2351 | 5,912 | py | Python | demo.py | HanMeh/ABMT | e2767bd29ad9e2da767948b5047cf7f287094c6b | [
"MIT"
] | 6 | 2020-08-15T12:00:37.000Z | 2022-01-27T04:29:07.000Z | demo.py | HanMeh/ABMT | e2767bd29ad9e2da767948b5047cf7f287094c6b | [
"MIT"
] | null | null | null | demo.py | HanMeh/ABMT | e2767bd29ad9e2da767948b5047cf7f287094c6b | [
"MIT"
] | 3 | 2020-08-15T09:45:17.000Z | 2021-02-09T18:24:38.000Z | """Main function of ABMT for the paper: Adversarial Brain Multiplex Prediction From a Single Brain Network with Application to Gender Fingerprinting
View Network Normalization
Details can be found in:
(1) the original paper
Ahmed Nebli, and Islem Rekik.
-----------------------------------------... | 62.893617 | 149 | 0.665934 | import argparse
import os
import scipy.misc
import numpy as np
from model_demo import graph2graph
import tensorflow as tf
import datetime
parser = argparse.ArgumentParser(description='')
parser.add_argument('--epoch', dest='epoch', type=int, default=1, help='# of epoch')
parser.add_argument('--batch_size', d... | true | true |
f76c6e06bacce1c73250313d7da851402cc9e757 | 24,210 | py | Python | src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py | UCD4IDS/sage | 43474c96d533fd396fe29fe0782d44dc7f5164f7 | [
"BSL-1.0"
] | 1,742 | 2015-01-04T07:06:13.000Z | 2022-03-30T11:32:52.000Z | src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py | UCD4IDS/sage | 43474c96d533fd396fe29fe0782d44dc7f5164f7 | [
"BSL-1.0"
] | 66 | 2015-03-19T19:17:24.000Z | 2022-03-16T11:59:30.000Z | src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py | UCD4IDS/sage | 43474c96d533fd396fe29fe0782d44dc7f5164f7 | [
"BSL-1.0"
] | 495 | 2015-01-10T10:23:18.000Z | 2022-03-24T22:06:11.000Z | """
Hyperelliptic curves over a general ring
EXAMPLES::
sage: P.<x> = GF(5)[]
sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1
sage: C = HyperellipticCurve(f); C
Hyperelliptic Curve over Finite Field of size 5 defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4
::
sage: P.<x> = QQ[]
sage: f ... | 36.515837 | 218 | 0.528418 |
from sage.rings.polynomial.all import PolynomialRing
from sage.rings.big_oh import O
from sage.rings.power_series_ring import PowerSeriesRing
from sage.rings.laurent_series_ring import LaurentSeriesRing
from sage.rings.real_mpfr import RR
from sage.functions.all import log
from sage.structure.category_object import n... | true | true |
f76c6f1b008dea41b128774fd328ba5cda948d89 | 15,729 | py | Python | pytorch_lightning/trainer/distrib_parts.py | lkhphuc/pytorch-lightning | 28f79d9f7ad7a249c7cbde2b98d6cb38fb4d755a | [
"MIT"
] | 2 | 2020-11-28T21:38:35.000Z | 2021-03-16T12:30:18.000Z | pytorch_lightning/trainer/distrib_parts.py | sudimuk2017/pytorch-lightning | 6ebe0d7266fe29104f4c68dd9143326132885a30 | [
"Apache-2.0"
] | null | null | null | pytorch_lightning/trainer/distrib_parts.py | sudimuk2017/pytorch-lightning | 6ebe0d7266fe29104f4c68dd9143326132885a30 | [
"Apache-2.0"
] | null | null | null | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 33.2537 | 124 | 0.660945 |
from contextlib import ExitStack
import os
from abc import ABC, abstractmethod
import time
import random
import torch
from torch.optim.lr_scheduler import _LRScheduler
from typing import Union, Callable, Any, List, Optional, Tuple, MutableSequence
from pytorch_lightning.core.lightning import LightningModule
from pyt... | true | true |
f76c6fe4100731795d0c12dd97d0713a91459dd8 | 40,940 | py | Python | sdk/lusid/rest.py | rizwansaeed/lusid-sdk-python-preview | 52d092d6d4099b8526f0318f3fe1ddc0b943da6a | [
"MIT"
] | null | null | null | sdk/lusid/rest.py | rizwansaeed/lusid-sdk-python-preview | 52d092d6d4099b8526f0318f3fe1ddc0b943da6a | [
"MIT"
] | null | null | null | sdk/lusid/rest.py | rizwansaeed/lusid-sdk-python-preview | 52d092d6d4099b8526f0318f3fe1ddc0b943da6a | [
"MIT"
] | null | null | null | # coding: utf-8
"""
LUSID API
# Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages : * [C#](https://gith... | 140.205479 | 28,647 | 0.656937 |
from __future__ import absolute_import
import io
import json
import logging
import re
import ssl
import certifi
import six
from six.moves.urllib.parse import urlencode
import urllib3
from lusid.exceptions import ApiException, ApiValueError
from lusid.tcp.tcp_keep_alive_probes import TCPKeepAlivePoolManager, TCPKe... | true | true |
f76c7007eee61816978704698e55a5c46c7796bc | 2,338 | py | Python | reconstruction/PBIDR/code/utils/general.py | xpertdev/insightface | 78654944d332573715c04ab5956761f5215d0f51 | [
"MIT"
] | 1 | 2021-10-31T09:02:34.000Z | 2021-10-31T09:02:34.000Z | reconstruction/PBIDR/code/utils/general.py | xpertdev/insightface | 78654944d332573715c04ab5956761f5215d0f51 | [
"MIT"
] | null | null | null | reconstruction/PBIDR/code/utils/general.py | xpertdev/insightface | 78654944d332573715c04ab5956761f5215d0f51 | [
"MIT"
] | null | null | null | import os
from glob import glob
import torch
def mkdir_ifnotexists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_class(kls):
parts = kls.split('.')
module = ".".join(parts[:-1])
m = __import__(module)
for comp in parts[1:]:
m = getattr(m, comp)
retur... | 35.424242 | 113 | 0.609068 | import os
from glob import glob
import torch
def mkdir_ifnotexists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_class(kls):
parts = kls.split('.')
module = ".".join(parts[:-1])
m = __import__(module)
for comp in parts[1:]:
m = getattr(m, comp)
retur... | true | true |
f76c710e9ddab78187f67c40ce5b8e6f8f2cdc08 | 4,107 | py | Python | docs/source/conf.py | shift-happens-benchmark/iclr-2022 | 63e1563d5cc9d0fb6ad993589f54ba5165510d67 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | shift-happens-benchmark/iclr-2022 | 63e1563d5cc9d0fb6ad993589f54ba5165510d67 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | shift-happens-benchmark/iclr-2022 | 63e1563d5cc9d0fb6ad993589f54ba5165510d67 | [
"Apache-2.0"
] | null | null | null | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 29.546763 | 117 | 0.640857 |
import datetime
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.abspath("../.."))
from typing import List
try:
import render_papers
render_papers.main()
except:
print("Did not update papers.rst")
autodoc_mock_imports = ["numpy", "torch", "torchvision", "... | true | true |
f76c7216f3fa2990771a2f1036aa6746ef4da19d | 6,760 | py | Python | sdk/python/pulumi_azure_native/security/latest/server_vulnerability_assessment.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/security/latest/server_vulnerability_assessment.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/security/latest/server_vulnerability_assessment.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | 50.074074 | 458 | 0.680473 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = ['ServerVulnerabilityAssessment']
warnings.warn("""The 'latest' version is deprecated. Please migrate to the resource in the top-level module: 'azure-native:sec... | true | true |
f76c72eadabf63fdaa26fd0b544d0d1dc6e47a88 | 14,453 | py | Python | sdk/python/pulumi_azure_native/sqlvirtualmachine/v20170301preview/sql_virtual_machine.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/sqlvirtualmachine/v20170301preview/sql_virtual_machine.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/sqlvirtualmachine/v20170301preview/sql_virtual_machine.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 48.6633 | 288 | 0.686501 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['SqlVirtualMachine']
class SqlVirtualMachine(pulumi.CustomResource):
def __init__(__sel... | true | true |
f76c73438345beb8ec5b881a80292be104ee9c30 | 8,606 | py | Python | tests/integ/test_tfs.py | jbarz1/sagemaker-python-sdk | a7399455f5386d83ddc5cb15c0db00c04bd518ec | [
"Apache-2.0"
] | 1 | 2020-09-22T19:13:36.000Z | 2020-09-22T19:13:36.000Z | tests/integ/test_tfs.py | jbarz1/sagemaker-python-sdk | a7399455f5386d83ddc5cb15c0db00c04bd518ec | [
"Apache-2.0"
] | 1 | 2019-04-23T19:32:17.000Z | 2019-04-23T19:32:17.000Z | tests/integ/test_tfs.py | jbarz1/sagemaker-python-sdk | a7399455f5386d83ddc5cb15c0db00c04bd518ec | [
"Apache-2.0"
] | null | null | null | # Copyright 2017-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 33.88189 | 100 | 0.716942 | from __future__ import absolute_import
import tarfile
import botocore.exceptions
import os
import pytest
import sagemaker
import sagemaker.predictor
import sagemaker.utils
import tests.integ
import tests.integ.timeout
from sagemaker.deserializers import JSONDeserializer
from sagemaker.tensorflow.model import TensorF... | true | true |
f76c742bba8c0f4c8466524789298161c62eb302 | 318 | py | Python | Aniyom Ebenezer/Phase 2/DICTIONARY/Day_50_Challenge_Solution/Question 3 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Aniyom Ebenezer/Phase 2/DICTIONARY/Day_50_Challenge_Solution/Question 3 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Aniyom Ebenezer/Phase 2/DICTIONARY/Day_50_Challenge_Solution/Question 3 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | """
Write a Python program to combine values in python list of dictionaries.
"""
from collections import Counter
item_list = [{'item': 'item1', 'amount': 400}, {'item': 'item2', 'amount': 300}, {'item': 'item1', 'amount': 750}]
result = Counter()
for d in item_list:
result[d['item']] += d['amount']
print(result) | 35.333333 | 114 | 0.654088 | from collections import Counter
item_list = [{'item': 'item1', 'amount': 400}, {'item': 'item2', 'amount': 300}, {'item': 'item1', 'amount': 750}]
result = Counter()
for d in item_list:
result[d['item']] += d['amount']
print(result) | true | true |
f76c767d28d8526cc0262a55b763e6745ed156fc | 5,691 | py | Python | PYTHON_AUTOMATION/04_second_02.py | sly1314sly/selenium_basic | 53bc2bf4d8a81bcd71f7fe5910cbc34ecfc6869a | [
"Apache-2.0"
] | 1 | 2019-08-03T04:24:13.000Z | 2019-08-03T04:24:13.000Z | PYTHON_AUTOMATION/04_second_02.py | sly1314sly/selenium_basic | 53bc2bf4d8a81bcd71f7fe5910cbc34ecfc6869a | [
"Apache-2.0"
] | null | null | null | PYTHON_AUTOMATION/04_second_02.py | sly1314sly/selenium_basic | 53bc2bf4d8a81bcd71f7fe5910cbc34ecfc6869a | [
"Apache-2.0"
] | null | null | null | #### 等待处理###显示等待和隐式等待
# time.sleep()这个是显示等待,又叫强制等待
# from selenium import webdriver
# from selenium.webdriver.common.by import By #引入这个by
# from selenium.webdriver.support.ui import WebDriverWait #引入等待条件
# from selenium.webdriver.support import expected_conditions as EC #根据什么条件等待
# driver = webdriver.Chrome()
# ... | 29.640625 | 145 | 0.656475 |
import xlwt
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.maximize_window() driver.implicitly_wait(30)
driver.get('https://s.weibo.com/')
keys = 'web自动化'
wb = xlwt.Workbook()
ws = wb.add_sheet(keys)
ws.write(0,0,'用户')
ws.write(0,1,... | true | true |
f76c76d69eddea6fac4a7db354d12a9607593e48 | 38,743 | py | Python | salt/states/pkg.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | null | null | null | salt/states/pkg.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | null | null | null | salt/states/pkg.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Installation of packages using OS package managers such as yum or apt-get
=========================================================================
Salt can manage software packages via the pkg state module, packages can be
set up to be installed, latest, removed and purged. Package managem... | 35.349453 | 85 | 0.529025 |
import logging
import os
import re
import salt.utils
from salt.utils import namespaced_function as _namespaced_function
from salt._compat import string_types
from salt.exceptions import CommandExecutionError, MinionError
from salt.modules.pkg_resource import _repack_pkgs
_repack_pkgs = _namespaced_function(_repack_p... | true | true |
f76c77553e91e35b295ef1a4b607f0f31cba2675 | 30,912 | py | Python | web/addons/crm/base_partner_merge.py | diogocs1/comps | 63df07f6cf21c41e4527c06e2d0499f23f4322e7 | [
"Apache-2.0"
] | null | null | null | web/addons/crm/base_partner_merge.py | diogocs1/comps | 63df07f6cf21c41e4527c06e2d0499f23f4322e7 | [
"Apache-2.0"
] | null | null | null | web/addons/crm/base_partner_merge.py | diogocs1/comps | 63df07f6cf21c41e4527c06e2d0499f23f4322e7 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from __future__ import absolute_import
from email.utils import parseaddr
import functools
import htmlentitydefs
import itertools
import logging
import operator
import psycopg2
import re
from ast import literal_eval
from openerp.tools import mute_logger
# Validation Library https://pypi.python.org... | 39.178707 | 221 | 0.547716 | from __future__ import absolute_import
from email.utils import parseaddr
import functools
import htmlentitydefs
import itertools
import logging
import operator
import psycopg2
import re
from ast import literal_eval
from openerp.tools import mute_logger
from .validate_email import validate_email
import openerp
from op... | true | true |
f76c77e4e622f5d3124804f7c553ab79daed5f41 | 508 | py | Python | eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Utils/htmlEncode.py | bopopescu/phyG | 023f505b705ab953f502cbc55e90612047867583 | [
"CC-BY-3.0"
] | 115 | 2015-01-02T12:23:59.000Z | 2021-12-22T08:18:04.000Z | eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Utils/htmlEncode.py | bopopescu/phyG | 023f505b705ab953f502cbc55e90612047867583 | [
"CC-BY-3.0"
] | 18 | 2017-03-20T14:12:58.000Z | 2021-07-28T09:11:55.000Z | eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Utils/htmlEncode.py | bopopescu/phyG | 023f505b705ab953f502cbc55e90612047867583 | [
"CC-BY-3.0"
] | 69 | 2015-03-12T07:40:21.000Z | 2020-04-04T15:15:55.000Z | """This is a copy of the htmlEncode function in Webware.
@@TR: It implemented more efficiently.
"""
htmlCodes = [
['&', '&'],
['<', '<'],
['>', '>'],
['"', '"'],
]
htmlCodesReversed = htmlCodes[:]
htmlCodesReversed.reverse()
def htmlEncode(s, codes=htmlCodes):
""" Returns the HTML... | 23.090909 | 79 | 0.604331 | htmlCodes = [
['&', '&'],
['<', '<'],
['>', '>'],
['"', '"'],
]
htmlCodesReversed = htmlCodes[:]
htmlCodesReversed.reverse()
def htmlEncode(s, codes=htmlCodes):
for code in codes:
s = s.replace(code[0], code[1])
return s
| true | true |
f76c786bfe7b60d1f48a0dff847861c34f2ee2b2 | 6,565 | py | Python | src/config/common/generatedssuper.py | amitkg29/contrail-controller | be71b50f185a68338ea54d6f8088623ab88c2bf6 | [
"Apache-2.0"
] | null | null | null | src/config/common/generatedssuper.py | amitkg29/contrail-controller | be71b50f185a68338ea54d6f8088623ab88c2bf6 | [
"Apache-2.0"
] | null | null | null | src/config/common/generatedssuper.py | amitkg29/contrail-controller | be71b50f185a68338ea54d6f8088623ab88c2bf6 | [
"Apache-2.0"
] | null | null | null | #
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import re
import sys
ExternalEncoding = sys.getdefaultencoding()
Tag_pattern_ = re.compile(r'({.*})?(.*)')
def showIndent(outfile, level, pretty_print=False):
for i in range(level - 1):
outfile.write(" ")
def quote_xml(inStr):
... | 29.177778 | 73 | 0.56131 | import re
import sys
ExternalEncoding = sys.getdefaultencoding()
Tag_pattern_ = re.compile(r'({.*})?(.*)')
def showIndent(outfile, level, pretty_print=False):
for i in range(level - 1):
outfile.write(" ")
def quote_xml(inStr):
if not inStr:
return ''
s1 = (isinstance(inStr, basestrin... | false | true |
f76c78a9ce8d181440c1ba1856eca20880d582b9 | 18,305 | py | Python | improver/nbhood/recursive_filter.py | cpelley/improver | ebf77fe2adc85ed7aec74c26671872a2e4388ded | [
"BSD-3-Clause"
] | 77 | 2017-04-26T07:47:40.000Z | 2022-03-31T09:40:49.000Z | improver/nbhood/recursive_filter.py | cpelley/improver | ebf77fe2adc85ed7aec74c26671872a2e4388ded | [
"BSD-3-Clause"
] | 1,440 | 2017-03-29T10:04:15.000Z | 2022-03-28T10:11:29.000Z | improver/nbhood/recursive_filter.py | MoseleyS/improver | ca028e3a1c842e3ff00b188c8ea6eaedd0a07149 | [
"BSD-3-Clause"
] | 72 | 2017-03-17T16:53:45.000Z | 2022-02-16T09:41:37.000Z | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 41.042601 | 88 | 0.599344 | import warnings
from typing import List, Optional, Tuple
import iris
import numpy as np
from iris.cube import Cube, CubeList
from numpy import ndarray
from improver import PostProcessingPlugin
from improver.generate_ancillaries.generate_orographic_smoothing_coefficients import (
OrographicSmoothingCoefficients,
)... | true | true |
f76c78e60e8a2f6272d3b9cf70ff4488d4d76410 | 697 | py | Python | client/verta/verta/_internal_utils/time_utils/_time_utils_py3.py | houqp/modeldb | 32837d9c1446f42882ae2a7729df1a08e33ac155 | [
"Apache-2.0"
] | null | null | null | client/verta/verta/_internal_utils/time_utils/_time_utils_py3.py | houqp/modeldb | 32837d9c1446f42882ae2a7729df1a08e33ac155 | [
"Apache-2.0"
] | null | null | null | client/verta/verta/_internal_utils/time_utils/_time_utils_py3.py | houqp/modeldb | 32837d9c1446f42882ae2a7729df1a08e33ac155 | [
"Apache-2.0"
] | 1 | 2021-05-04T13:52:09.000Z | 2021-05-04T13:52:09.000Z | # -*- coding: utf-8 -*-
# pylint: disable=undefined-variable,no-name-in-module
from datetime import datetime, timedelta, timezone
import time
UNIX_EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)
def now():
return datetime.now(timezone.utc)
def now_in_millis():
return int(round(time.time() * 1000))
def... | 23.233333 | 73 | 0.685796 |
from datetime import datetime, timedelta, timezone
import time
UNIX_EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)
def now():
return datetime.now(timezone.utc)
def now_in_millis():
return int(round(time.time() * 1000))
def epoch_millis(dt):
if isinstance(dt, datetime):
return int(round((d... | true | true |
f76c7a7ce68bf5a3c7359509b293f5c12114ae42 | 27,782 | py | Python | backend/kin_genomic_privacy/sequenced_family_tree.py | isplab-unil/kin-genomic-privacy | a563a1cc02269d240efd687b64d20f25b12a9650 | [
"Apache-2.0"
] | null | null | null | backend/kin_genomic_privacy/sequenced_family_tree.py | isplab-unil/kin-genomic-privacy | a563a1cc02269d240efd687b64d20f25b12a9650 | [
"Apache-2.0"
] | null | null | null | backend/kin_genomic_privacy/sequenced_family_tree.py | isplab-unil/kin-genomic-privacy | a563a1cc02269d240efd687b64d20f25b12a9650 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
__author__ = "Didier Dupertuis, Benjamin Trubert, Kévin Huguenin"
__copyright__ = "Copyright 2019, The Information Security and Privacy Lab at the University of Lausanne (https://www.unil.ch/isplab/)"
__credits__ = ["Didier Dupertuis", "Benjamin Trubert", "Kévin Huguenin", "Mathias Humbert"]
_... | 43.751181 | 152 | 0.623965 |
__author__ = "Didier Dupertuis, Benjamin Trubert, Kévin Huguenin"
__copyright__ = "Copyright 2019, The Information Security and Privacy Lab at the University of Lausanne (https://www.unil.ch/isplab/)"
__credits__ = ["Didier Dupertuis", "Benjamin Trubert", "Kévin Huguenin", "Mathias Humbert"]
__version__ = "1"
__licen... | true | true |
f76c7b43e06bb1a6929e1c319cd74b90d0634aa7 | 311 | py | Python | examples/Terminal/lt_check.py | waldyrious/galgebra | b5eb070340434d030dd737a5656fbf709538b0b1 | [
"BSD-3-Clause"
] | 151 | 2018-09-18T12:30:14.000Z | 2022-03-16T08:02:48.000Z | examples/Terminal/lt_check.py | abrombo/galgebra | 5ae058c9ba2c17b1baf46c58f77124e82eaf428a | [
"BSD-3-Clause"
] | 454 | 2018-09-19T01:42:30.000Z | 2022-01-18T14:02:00.000Z | examples/Terminal/lt_check.py | abrombo/galgebra | 5ae058c9ba2c17b1baf46c58f77124e82eaf428a | [
"BSD-3-Clause"
] | 30 | 2019-02-22T08:25:50.000Z | 2022-01-15T05:20:22.000Z | from __future__ import print_function
import sympy
from galgebra import ga
base=ga.Ga('e0 e1',g=[1,1],coords=sympy.symbols('x,y',real=True))
e0,e1 = base.mv()
M=[[1,2],[3,4]]
Mvec = [e0+2*e1,3*e0+4*e1]
#print M[0][0],M[0][1]
#print M[1][0],M[1][1]
print(base.lt(Mvec))
print(base.lt(M))
print(sympy.Matrix(M))
| 22.214286 | 65 | 0.655949 | from __future__ import print_function
import sympy
from galgebra import ga
base=ga.Ga('e0 e1',g=[1,1],coords=sympy.symbols('x,y',real=True))
e0,e1 = base.mv()
M=[[1,2],[3,4]]
Mvec = [e0+2*e1,3*e0+4*e1]
print(base.lt(Mvec))
print(base.lt(M))
print(sympy.Matrix(M))
| true | true |
f76c7bcd63e4ece39d665b7e82cdb939fdded0d3 | 1,811 | py | Python | src/hamcrest/core/matcher.py | pexip/os-pyhamcrest | 6533db5b8c6f27ff69ffcc661c4160207e35aa47 | [
"BSD-3-Clause"
] | null | null | null | src/hamcrest/core/matcher.py | pexip/os-pyhamcrest | 6533db5b8c6f27ff69ffcc661c4160207e35aa47 | [
"BSD-3-Clause"
] | null | null | null | src/hamcrest/core/matcher.py | pexip/os-pyhamcrest | 6533db5b8c6f27ff69ffcc661c4160207e35aa47 | [
"BSD-3-Clause"
] | null | null | null | from selfdescribing import SelfDescribing
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
class Matcher(SelfDescribing):
"""A matcher over acceptable values.
A matcher is able to describe itself to give feedback when it fails.
Matcher implement... | 34.826923 | 78 | 0.686913 | from selfdescribing import SelfDescribing
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
class Matcher(SelfDescribing):
def matches(self, item, mismatch_description=None):
raise NotImplementedError('matches')
def describe_mismatch(self, it... | true | true |
f76c7c8e3b0168598011b92d46c74c6a02c092e7 | 7,674 | py | Python | release/stubs.min/System/Windows/Media/Animation_parts/LinearColorKeyFrame.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/System/Windows/Media/Animation_parts/LinearColorKeyFrame.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/System/Windows/Media/Animation_parts/LinearColorKeyFrame.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | class LinearColorKeyFrame(ColorKeyFrame, ISealable, IKeyFrame):
"""
Animates from the System.Windows.Media.Color value of the previous key frame to its own System.Windows.Media.Animation.ColorKeyFrame.Value using linear interpolation.
LinearColorKeyFrame()
LinearColorKeyFrame(value: Color)
Linea... | 26.280822 | 221 | 0.689992 | class LinearColorKeyFrame(ColorKeyFrame, ISealable, IKeyFrame):
def CloneCore(self, *args):
pass
def CloneCurrentValueCore(self, *args):
pass
def CreateInstance(self, *args):
pass
def CreateInstanceCore(self, *args):
pass
def FreezeCore(self, *args)... | true | true |
f76c7caf1afad33299b423b80de14f6376e89135 | 8,003 | py | Python | inferential/test/test_ttests.py | eribean/RyStats | 1cdd0ea55a074cc81e61d2845216f395ba095f10 | [
"MIT"
] | 4 | 2021-08-05T11:47:30.000Z | 2021-10-31T12:03:48.000Z | inferential/test/test_ttests.py | eribean/RyStats | 1cdd0ea55a074cc81e61d2845216f395ba095f10 | [
"MIT"
] | 12 | 2021-08-05T11:43:22.000Z | 2021-10-29T18:05:48.000Z | inferential/test/test_ttests.py | eribean/RyStats | 1cdd0ea55a074cc81e61d2845216f395ba095f10 | [
"MIT"
] | null | null | null | import unittest
import numpy as np
from RyStats.inferential import (unequal_variance_ttest, equal_variance_ttest,
one_sample_ttest, repeated_ttest)
from RyStats.inferential.ttests import _p_value_and_confidence_intervals
class TestEqualVariance(uni... | 29.315018 | 105 | 0.566038 | import unittest
import numpy as np
from RyStats.inferential import (unequal_variance_ttest, equal_variance_ttest,
one_sample_ttest, repeated_ttest)
from RyStats.inferential.ttests import _p_value_and_confidence_intervals
class TestEqualVariance(uni... | true | true |
f76c7d5c97be295e0a4f94c073c8aeb0e8e37764 | 4,111 | py | Python | py_torch/IoU_loss_test.py | cheind/pytorch-blender-dr | fd2e449dd81723bb1978f005736104f27cc1770b | [
"MIT"
] | 5 | 2020-09-09T13:25:08.000Z | 2021-12-11T20:09:44.000Z | py_torch/IoU_loss_test.py | cheind/pytorch-blender-dr | fd2e449dd81723bb1978f005736104f27cc1770b | [
"MIT"
] | 1 | 2020-11-23T14:11:06.000Z | 2020-11-23T14:11:06.000Z | py_torch/IoU_loss_test.py | cheind/pytorch-blender-dr | fd2e449dd81723bb1978f005736104f27cc1770b | [
"MIT"
] | 1 | 2021-01-05T22:27:23.000Z | 2021-01-05T22:27:23.000Z | import torch
import numpy as np
import math
def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9):
# Returns the IoU of box1 to box2. box1 is 4, box2 is nx4
box2 = box2.T # 4xn
# Get the coordinates of bounding boxes
if x1y1x2y2: # x1, y1, x2, y2 = box1
... | 50.134146 | 109 | 0.548042 | import torch
import numpy as np
import math
def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9):
box2 = box2.T
if x1y1x2y2: b1_x1, b1_y1, b1_x2, b1_y2 = box1[0], box1[1], box1[2], box1[3]
b2_x1, b2_y1, b2_x2, b2_y2 = box2[0], box2[1], box2[2],... | true | true |
f76c7e000998b4e0217e3a307da364c67858bff0 | 2,164 | py | Python | examples/fedsarah/fedsarah_client.py | crownk1997/plato | 56eecedd291f9dc9de9d101c9d87dea320dfacd4 | [
"Apache-2.0"
] | null | null | null | examples/fedsarah/fedsarah_client.py | crownk1997/plato | 56eecedd291f9dc9de9d101c9d87dea320dfacd4 | [
"Apache-2.0"
] | null | null | null | examples/fedsarah/fedsarah_client.py | crownk1997/plato | 56eecedd291f9dc9de9d101c9d87dea320dfacd4 | [
"Apache-2.0"
] | 1 | 2021-11-29T15:47:27.000Z | 2021-11-29T15:47:27.000Z | """
A customized client for FedSarah.
Reference: Ngunyen et al., "SARAH: A Novel Method for Machine Learning Problems
Using Stochastic Recursive Gradient." (https://arxiv.org/pdf/1703.00102.pdf)
"""
import os
import time
from dataclasses import dataclass
from plato.clients import simple
@dataclass
class Report(sim... | 34.903226 | 100 | 0.688078 | import os
import time
from dataclasses import dataclass
from plato.clients import simple
@dataclass
class Report(simple.Report):
payload_length: int
class Client(simple.Client):
def __init__(self,
model=None,
datasource=None,
algorithm=None,
... | true | true |
f76c7eb7dd33c813bf3b40000f3a3a0783481b65 | 4,181 | py | Python | 20_solo/lib/configs_base/solov2_resnext101_dcn.py | Boltuzamaki/Monk_Object_Detection | baf113ef6db8b531d0ef6413538e49d422163a20 | [
"Apache-2.0"
] | 549 | 2020-01-02T05:14:57.000Z | 2022-03-29T18:34:12.000Z | 20_solo/lib/configs_base/solov2_resnext101_dcn.py | Boltuzamaki/Monk_Object_Detection | baf113ef6db8b531d0ef6413538e49d422163a20 | [
"Apache-2.0"
] | 98 | 2020-01-21T09:41:30.000Z | 2022-03-12T00:53:06.000Z | 20_solo/lib/configs_base/solov2_resnext101_dcn.py | Boltuzamaki/Monk_Object_Detection | baf113ef6db8b531d0ef6413538e49d422163a20 | [
"Apache-2.0"
] | 233 | 2020-01-18T03:46:27.000Z | 2022-03-19T03:17:47.000Z | # model settings
model = dict(
type='SOLOv2',
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
dcn=d... | 28.25 | 78 | 0.580005 | model = dict(
type='SOLOv2',
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
dcn=dict(
... | false | true |
f76c7eea7aa1f5ac607f2e4ddefa49329ddb9f7e | 6,305 | py | Python | server/algorithms/AlgoBinome.py | ETN-Tech/isen_emergence-app | 25e8dd198e4e9cc7513bbc56a2d89b3566407c7f | [
"MIT"
] | 1 | 2021-04-03T20:52:01.000Z | 2021-04-03T20:52:01.000Z | server/algorithms/AlgoBinome.py | ETN-Tech/isen_emergence-app | 25e8dd198e4e9cc7513bbc56a2d89b3566407c7f | [
"MIT"
] | 4 | 2022-01-27T21:49:38.000Z | 2022-01-27T21:49:45.000Z | server/algorithms/AlgoBinome.py | ETN-Tech/isen_emergence-app | 25e8dd198e4e9cc7513bbc56a2d89b3566407c7f | [
"MIT"
] | null | null | null |
#This algorithms create final pairs godfather-laureate according to the marks each godfathers and laureates gives at the end of their meetings
#
#The aim of this algorithms is to maximize the satisfaction rate of the pairS (average of all the marks godfathers and laureates give to their associated pair)
# input fi... | 43.184932 | 2,848 | 0.626011 |
#
# !! Maybe the number of godfather and laureates are not the same ? !!
# Average satisfaction rate : 3.07/4 test with random marks for 40 laureates and 40 godfathers
from ortools.sat.python import cp_model
import random
import json
import sys
dictresult={}
if len(sys.argv) != 2:
exit('... | true | true |
f76c7f5d334a1e9298ce5bf815caafd63daeb5fd | 209 | py | Python | tests/nn/test_layers.py | IncyLiu/autokeras | e9dbf66b005e2ffaabe29bc366bb4e72fa79add8 | [
"MIT"
] | 1 | 2019-01-14T11:19:06.000Z | 2019-01-14T11:19:06.000Z | tests/nn/test_layers.py | IncyLiu/autokeras | e9dbf66b005e2ffaabe29bc366bb4e72fa79add8 | [
"MIT"
] | 1 | 2019-03-06T02:20:08.000Z | 2019-03-06T02:20:08.000Z | tests/nn/test_layers.py | IncyLiu/autokeras | e9dbf66b005e2ffaabe29bc366bb4e72fa79add8 | [
"MIT"
] | 2 | 2018-11-12T19:43:31.000Z | 2018-11-26T08:14:32.000Z | from autokeras.nn.layers import *
import numpy as np
def test_global_layer():
layer = GlobalAvgPool2d()
inputs = torch.Tensor(np.ones((100, 50, 30, 40)))
assert layer(inputs).size() == (100, 50)
| 23.222222 | 53 | 0.669856 | from autokeras.nn.layers import *
import numpy as np
def test_global_layer():
layer = GlobalAvgPool2d()
inputs = torch.Tensor(np.ones((100, 50, 30, 40)))
assert layer(inputs).size() == (100, 50)
| true | true |
f76c806e3a490f948309aeff9f797da9ff3626d9 | 4,540 | py | Python | migrations/versions/847f24db2b48_.py | gedoensmanagement/Transkribus_spell_checker | 1413f1de137e786a4f078e6806b2e856120e78ea | [
"MIT"
] | null | null | null | migrations/versions/847f24db2b48_.py | gedoensmanagement/Transkribus_spell_checker | 1413f1de137e786a4f078e6806b2e856120e78ea | [
"MIT"
] | null | null | null | migrations/versions/847f24db2b48_.py | gedoensmanagement/Transkribus_spell_checker | 1413f1de137e786a4f078e6806b2e856120e78ea | [
"MIT"
] | null | null | null | """empty message
Revision ID: 847f24db2b48
Revises:
Create Date: 2021-09-14 20:46:44.700753
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '847f24db2b48'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | 39.824561 | 67 | 0.661674 | from alembic import op
import sqlalchemy as sa
revision = '847f24db2b48'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=100), nullable=False),
sa.Column('pass... | true | true |
f76c80d35e86676093d9e65088c4d0b56c173f06 | 645 | py | Python | next-greater-numerically-balanced-number/next-greater-numerically-balanced-number.py | kayanmorshed/Leetcode | 233e50a069a69fbe126dc86d293d4024eb070b8a | [
"MIT"
] | null | null | null | next-greater-numerically-balanced-number/next-greater-numerically-balanced-number.py | kayanmorshed/Leetcode | 233e50a069a69fbe126dc86d293d4024eb070b8a | [
"MIT"
] | null | null | null | next-greater-numerically-balanced-number/next-greater-numerically-balanced-number.py | kayanmorshed/Leetcode | 233e50a069a69fbe126dc86d293d4024eb070b8a | [
"MIT"
] | null | null | null | class Solution:
def nextBeautifulNumber(self, n: int) -> int:
i = n+1
while True:
strn = str(i)
map_n = {}
for ch in strn:
if ch not in map_n:
map_n[ch] = 1
else:
... | 23.888889 | 49 | 0.289922 | class Solution:
def nextBeautifulNumber(self, n: int) -> int:
i = n+1
while True:
strn = str(i)
map_n = {}
for ch in strn:
if ch not in map_n:
map_n[ch] = 1
else:
... | true | true |
f76c80f2a5d4d5bc130b7640ab87ece0b5b3ed93 | 6,229 | py | Python | 6001x/wordgame/wordgameB.py | CarlosEduardoAS/MITx | 532695d69c77581b6df80c145283b349b75e4973 | [
"MIT"
] | null | null | null | 6001x/wordgame/wordgameB.py | CarlosEduardoAS/MITx | 532695d69c77581b6df80c145283b349b75e4973 | [
"MIT"
] | null | null | null | 6001x/wordgame/wordgameB.py | CarlosEduardoAS/MITx | 532695d69c77581b6df80c145283b349b75e4973 | [
"MIT"
] | null | null | null | from wordgameA import *
import time
#
#
# Computer chooses a word
#
#
def compChooseWord(hand, wordList, n):
"""
Given a hand and a wordList, find the word that gives
the maximum value score, and return it.
This word should be calculated by considering all the words
in the wordList.
If no w... | 36.426901 | 125 | 0.58918 | from wordgameA import *
import time
def compChooseWord(hand, wordList, n):
bestScore = 0
bestWord = None
for word in wordList:
if isValidWord(word, hand, wordList):
score = getWordScore(word, n)
if (score > bestScore):
... | true | true |
f76c814c72d17b28012dffe6c568a6c680b69c76 | 2,174 | py | Python | lights.py | h42i/trafficlight | 4d1b0a37a0eccfb5c25ba80395af860382e731fb | [
"MIT"
] | 3 | 2017-07-05T18:08:38.000Z | 2021-09-04T04:41:48.000Z | lights.py | h42i/trafficlight | 4d1b0a37a0eccfb5c25ba80395af860382e731fb | [
"MIT"
] | null | null | null | lights.py | h42i/trafficlight | 4d1b0a37a0eccfb5c25ba80395af860382e731fb | [
"MIT"
] | null | null | null | from machine import Pin
from apa102 import APA102
import time
class Lights:
counter = None
apa = None
def __init__(self):
clock = Pin(12, Pin.OUT) # Green
data = Pin(13, Pin.OUT) # Yellow
self.apa = APA102(clock, data, 56)
self.counter = 0
def set_l... | 24.704545 | 61 | 0.520239 | from machine import Pin
from apa102 import APA102
import time
class Lights:
counter = None
apa = None
def __init__(self):
clock = Pin(12, Pin.OUT) data = Pin(13, Pin.OUT) self.apa = APA102(clock, data, 56)
self.counter = 0
def set_low_load(self):
... | true | true |
f76c82a0bdbca528c815aad325ac74d8c3257564 | 858 | py | Python | scipy_central/feeds/urls.py | wqshi/test | 63dc0c684ec749cd03e9c071176f30f439188f14 | [
"BSD-3-Clause"
] | 7 | 2016-02-03T12:44:33.000Z | 2020-08-26T09:22:23.000Z | scipy_central/feeds/urls.py | wqshi/test | 63dc0c684ec749cd03e9c071176f30f439188f14 | [
"BSD-3-Clause"
] | 19 | 2015-01-20T11:27:22.000Z | 2017-09-23T22:26:18.000Z | scipy_central/feeds/urls.py | wqshi/test | 63dc0c684ec749cd03e9c071176f30f439188f14 | [
"BSD-3-Clause"
] | 9 | 2015-01-03T02:56:33.000Z | 2021-02-20T10:45:11.000Z | from django.conf.urls.defaults import patterns, url
from django.contrib.comments.feeds import LatestCommentFeed
import feeds
urlpatterns = patterns('scipy_central.feeds.views',
# latest comments
url(r'^comments/$', LatestCommentFeed(), name="spc-rss-latest-comments"),
# all revision comments
url(r'^comments/(?P<it... | 45.157895 | 107 | 0.693473 | from django.conf.urls.defaults import patterns, url
from django.contrib.comments.feeds import LatestCommentFeed
import feeds
urlpatterns = patterns('scipy_central.feeds.views',
url(r'^comments/$', LatestCommentFeed(), name="spc-rss-latest-comments"),
url(r'^comments/(?P<item_id>\d+)/(?P<rev_id>\d+)/$', feeds.RssCo... | true | true |
f76c83105f3d6379ba519f406706a9f3637daab7 | 4,388 | py | Python | examples/MKID_pic.py | RupertDodkins/medis | bdb1f00fb93506da2a1f251bc6780e70e97a16c5 | [
"MIT"
] | 1 | 2021-06-25T17:35:56.000Z | 2021-06-25T17:35:56.000Z | examples/MKID_pic.py | RupertDodkins/medis | bdb1f00fb93506da2a1f251bc6780e70e97a16c5 | [
"MIT"
] | null | null | null | examples/MKID_pic.py | RupertDodkins/medis | bdb1f00fb93506da2a1f251bc6780e70e97a16c5 | [
"MIT"
] | 2 | 2018-12-08T15:05:13.000Z | 2019-08-08T17:28:24.000Z | import os
import numpy as np
import matplotlib as mpl
mpl.use('Qt5Agg')
from medis.params import tp, mp, cp, sp, ap, iop
import medis.Detector.get_photon_data as gpd
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from medis.Utils.plot_tools import loop_frames, quicklook_im, view_datacube, compare... | 31.120567 | 158 | 0.617821 | import os
import numpy as np
import matplotlib as mpl
mpl.use('Qt5Agg')
from medis.params import tp, mp, cp, sp, ap, iop
import medis.Detector.get_photon_data as gpd
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from medis.Utils.plot_tools import loop_frames, quicklook_im, view_datacube, compare... | true | true |
f76c8393cb078794da1cd3cc30e31c96f9685836 | 14,096 | py | Python | sfepy/terms/terms_basic.py | BubuLK/sfepy | 3e8e2082c26d574dc334fe3a0e0eeb723f7a6657 | [
"BSD-3-Clause"
] | 1 | 2021-05-15T16:28:45.000Z | 2021-05-15T16:28:45.000Z | sfepy/terms/terms_basic.py | Moyunning/sfepy | 127ab753a2f4f24ed359d0152088d11227c3dd49 | [
"BSD-3-Clause"
] | null | null | null | sfepy/terms/terms_basic.py | Moyunning/sfepy | 127ab753a2f4f24ed359d0152088d11227c3dd49 | [
"BSD-3-Clause"
] | null | null | null | import numpy as nm
from sfepy.base.base import assert_
from sfepy.linalg import dot_sequences
from sfepy.terms.terms import Term, terms
class ZeroTerm(Term):
r"""
A do-nothing term useful for introducing additional variables into the
equations.
:Definition:
.. math::
0
:Arguments:
... | 28.592292 | 80 | 0.565834 | import numpy as nm
from sfepy.base.base import assert_
from sfepy.linalg import dot_sequences
from sfepy.terms.terms import Term, terms
class ZeroTerm(Term):
name = 'dw_zero'
arg_types = ('virtual', 'state')
arg_shapes = {'virtual' : ('N', None), 'state' : 'N'}
@staticmethod
def function(out):
... | true | true |
f76c840980de82864b1543f3eb062a59fb76d415 | 3,006 | py | Python | retro_data_structures/conversion/evnt.py | duncathan/Retro-data-structures | 88c0a685e45c9c6935c1bd9d95ba549849947beb | [
"MIT"
] | 2 | 2021-06-18T16:47:00.000Z | 2021-07-06T22:36:32.000Z | retro_data_structures/conversion/evnt.py | duncathan/Retro-data-structures | 88c0a685e45c9c6935c1bd9d95ba549849947beb | [
"MIT"
] | 1 | 2021-10-01T20:26:01.000Z | 2021-10-01T20:26:01.000Z | retro_data_structures/conversion/evnt.py | duncathan/Retro-data-structures | 88c0a685e45c9c6935c1bd9d95ba549849947beb | [
"MIT"
] | 5 | 2021-08-23T17:01:01.000Z | 2021-11-20T03:57:14.000Z | from retro_data_structures.conversion.asset_converter import AssetConverter, Resource, AssetDetails
from retro_data_structures.conversion.errors import UnsupportedTargetGame, UnsupportedSourceGame
from retro_data_structures.game_check import Game
_BONE_NAME_MAPPING = {
"Skeleton_Root": 1,
"root": 0,
"Elect... | 32.673913 | 99 | 0.687625 | from retro_data_structures.conversion.asset_converter import AssetConverter, Resource, AssetDetails
from retro_data_structures.conversion.errors import UnsupportedTargetGame, UnsupportedSourceGame
from retro_data_structures.game_check import Game
_BONE_NAME_MAPPING = {
"Skeleton_Root": 1,
"root": 0,
"Elect... | true | true |
f76c844b5c7b1e0d8e139346ea02bb96f3574719 | 14,789 | py | Python | binder/awkward/generate.py | kgizdov/awkward-0.x | 11953017a5495527169d3a031a5e866904d824a2 | [
"BSD-3-Clause"
] | 224 | 2018-07-01T00:28:27.000Z | 2020-11-16T11:00:25.000Z | binder/awkward/generate.py | kgizdov/awkward-0.x | 11953017a5495527169d3a031a5e866904d824a2 | [
"BSD-3-Clause"
] | 196 | 2018-07-12T06:48:42.000Z | 2020-11-01T17:18:51.000Z | binder/awkward/generate.py | kgizdov/awkward-0.x | 11953017a5495527169d3a031a5e866904d824a2 | [
"BSD-3-Clause"
] | 42 | 2018-06-28T11:36:55.000Z | 2020-10-23T03:24:31.000Z | #!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-array/blob/master/LICENSE
import codecs
import collections
import numbers
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import numpy
import awkward.type
import awkward.uti... | 34.233796 | 133 | 0.621408 |
import codecs
import collections
import numbers
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import numpy
import awkward.type
import awkward.util
def typeof(obj):
if obj is None:
return None
elif isinstance(obj, (bool, numpy.bool_, numpy.bo... | true | true |
f76c84a9360ecd91ea30e54b8d2ccef9c1b13628 | 1,252 | py | Python | utils/data.py | mycal-tucker/IC3Net | bd71cc92d3ec5a5bfc12860babdb5a570421021d | [
"MIT"
] | null | null | null | utils/data.py | mycal-tucker/IC3Net | bd71cc92d3ec5a5bfc12860babdb5a570421021d | [
"MIT"
] | null | null | null | utils/data.py | mycal-tucker/IC3Net | bd71cc92d3ec5a5bfc12860babdb5a570421021d | [
"MIT"
] | null | null | null | import gym
from env_wrappers import *
def init(env_name, args, final_init=True):
if env_name == 'levers':
env = gym.make('Levers-v0')
env.multi_agent_init(args.total_agents, args.nagents)
env = GymWrapper(env)
elif env_name == 'number_pairs':
env = gym.make('NumberPairs-v0')
... | 30.536585 | 61 | 0.603035 | import gym
from env_wrappers import *
def init(env_name, args, final_init=True):
if env_name == 'levers':
env = gym.make('Levers-v0')
env.multi_agent_init(args.total_agents, args.nagents)
env = GymWrapper(env)
elif env_name == 'number_pairs':
env = gym.make('NumberPairs-v0')
... | true | true |
f76c84d38b7a4d9df48ec05bbb14f378e145ce58 | 7,785 | py | Python | tools/redfish-schema/generate_from_schema.py | jenningsloy318/gofish | 3dd54eaf633b27b447e1e13e7409a8e16037f788 | [
"Apache-2.0"
] | null | null | null | tools/redfish-schema/generate_from_schema.py | jenningsloy318/gofish | 3dd54eaf633b27b447e1e13e7409a8e16037f788 | [
"Apache-2.0"
] | null | null | null | tools/redfish-schema/generate_from_schema.py | jenningsloy318/gofish | 3dd54eaf633b27b447e1e13e7409a8e16037f788 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 31.26506 | 108 | 0.569814 |
import argparse
import io
import logging
import pprint
import textwrap
import jinja2
import requests
LOG = logging.getLogger(__name__)
SCHEMA_BASE = 'http://redfish.dmtf.org/schemas/'
COMMON_NAME_CHANGES = {
'Oem': 'OEM',
'Id': 'ID',
}
COMMON_DESC = {
'Description': 'Description provides a descriptio... | true | true |
f76c852566423d612bc9cb3a0d37b9a741b3d5d3 | 32,697 | py | Python | coref_model.py | SebastianJia/e2e-coref | 9a68d6816cfb4ac00bca9c83f587891239215dce | [
"Apache-2.0"
] | null | null | null | coref_model.py | SebastianJia/e2e-coref | 9a68d6816cfb4ac00bca9c83f587891239215dce | [
"Apache-2.0"
] | null | null | null | coref_model.py | SebastianJia/e2e-coref | 9a68d6816cfb4ac00bca9c83f587891239215dce | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import operator
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import h5py
import util
import coref_ops
import conll
im... | 56.864348 | 209 | 0.727743 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import operator
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import h5py
import util
import coref_ops
import conll
im... | true | true |
f76c85447604a1790669e4be00302bc3caf13de6 | 773 | py | Python | challenge_2/python/flickdm/test.py | rchicoli/2017-challenges | 44f0b672e5dea34de1dde131b6df837d462f8e29 | [
"Apache-2.0"
] | 271 | 2017-01-01T22:58:36.000Z | 2021-11-28T23:05:29.000Z | challenge_2/python/flickdm/test.py | AakashOfficial/2017Challenges | a8f556f1d5b43c099a0394384c8bc2d826f9d287 | [
"Apache-2.0"
] | 283 | 2017-01-01T23:26:05.000Z | 2018-03-23T00:48:55.000Z | challenge_2/python/flickdm/test.py | AakashOfficial/2017Challenges | a8f556f1d5b43c099a0394384c8bc2d826f9d287 | [
"Apache-2.0"
] | 311 | 2017-01-01T22:59:23.000Z | 2021-09-23T00:29:12.000Z | import unittest
from challenge2 import findSingleton
class TestFindSingleton(unittest.TestCase):
def test_base_case(self):
aList = [2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10, 9, 8, 7, 8, 10, 7]
bList = [2,'a', 'l', 3, 'l', 4, 'k', 2, 3, 4, 5, 'a', 6, 'c', 4, 'm', 6, 'm', 'k', 9, 10, 9, 8, 7, 8, 10, 7]
... | 28.62963 | 116 | 0.556274 | import unittest
from challenge2 import findSingleton
class TestFindSingleton(unittest.TestCase):
def test_base_case(self):
aList = [2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10, 9, 8, 7, 8, 10, 7]
bList = [2,'a', 'l', 3, 'l', 4, 'k', 2, 3, 4, 5, 'a', 6, 'c', 4, 'm', 6, 'm', 'k', 9, 10, 9, 8, 7, 8, 10, 7]
... | true | true |
f76c8835b00d61466271cb40a1440b642ca5430c | 10,189 | py | Python | tests/test_score.py | cambiegroup/aizynthfinder | f5bafb2ac4749284571c05ae6df45b6f45cccd30 | [
"MIT"
] | 2 | 2021-07-16T01:10:29.000Z | 2021-07-16T01:10:35.000Z | tests/test_score.py | cambiegroup/aizynthfinder | f5bafb2ac4749284571c05ae6df45b6f45cccd30 | [
"MIT"
] | null | null | null | tests/test_score.py | cambiegroup/aizynthfinder | f5bafb2ac4749284571c05ae6df45b6f45cccd30 | [
"MIT"
] | null | null | null | import pytest
import numpy as np
from aizynthfinder.context.scoring import (
StateScorer,
NumberOfReactionsScorer,
AverageTemplateOccurenceScorer,
NumberOfPrecursorsScorer,
NumberOfPrecursorsInStockScorer,
PriceSumScorer,
RouteCostScorer,
ScorerCollection,
ScorerException,
)
from ai... | 34.191275 | 88 | 0.725488 | import pytest
import numpy as np
from aizynthfinder.context.scoring import (
StateScorer,
NumberOfReactionsScorer,
AverageTemplateOccurenceScorer,
NumberOfPrecursorsScorer,
NumberOfPrecursorsInStockScorer,
PriceSumScorer,
RouteCostScorer,
ScorerCollection,
ScorerException,
)
from ai... | true | true |
f76c88e30e64bb75c39d97a9ae11916ed43a2caa | 12,059 | py | Python | alipay/aop/api/domain/InvoiceTradeInfo.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/InvoiceTradeInfo.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/InvoiceTradeInfo.py | articuly/alipay-sdk-python-all | 0259cd28eca0f219b97dac7f41c2458441d5e7a6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.InvoiceItemQueryOpenModel import InvoiceItemQueryOpenModel
from alipay.aop.api.domain.InvoiceTradeFundItem import InvoiceTradeFundItem
from alipay.aop.api.domain.Invoi... | 36.322289 | 95 | 0.60743 | import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.InvoiceItemQueryOpenModel import InvoiceItemQueryOpenModel
from alipay.aop.api.domain.InvoiceTradeFundItem import InvoiceTradeFundItem
from alipay.aop.api.domain.InvoiceTradeGoodsItem import InvoiceTradeGoodsItem
... | true | true |
f76c89c91deb3484eaf36abe6766e0a24f8978b6 | 4,711 | py | Python | litex_boards/targets/minispartan6.py | storborg/litex-boards | 45bb329b5638f435d561e009b62547c2827f66e2 | [
"BSD-2-Clause"
] | null | null | null | litex_boards/targets/minispartan6.py | storborg/litex-boards | 45bb329b5638f435d561e009b62547c2827f66e2 | [
"BSD-2-Clause"
] | null | null | null | litex_boards/targets/minispartan6.py | storborg/litex-boards | 45bb329b5638f435d561e009b62547c2827f66e2 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python3
# This file is Copyright (c) 2013-2014 Sebastien Bourdeauducq <sb@m-labs.hk>
# This file is Copyright (c) 2014-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# This file is Copyright (c) 2014 Yann Sionneau <ys@m-labs.hk>
# License: BSD
import os
import argparse
from fractions import Fraction... | 41.324561 | 113 | 0.556357 |
import os
import argparse
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.build.io import DDROutput
from litex_boards.platforms import minispartan6
from litex.soc.cores.clock import S6PLL
from litex.soc.integration.soc_core import *
from lite... | true | true |
f76c89dfd547e3f00fb99d8ff099b768328652cf | 799 | py | Python | ngo_geomap/urls.py | Omulosi/ngo_geomap | f3d22112f26388db3dfc7239eb540a2f4143cb59 | [
"MIT"
] | null | null | null | ngo_geomap/urls.py | Omulosi/ngo_geomap | f3d22112f26388db3dfc7239eb540a2f4143cb59 | [
"MIT"
] | null | null | null | ngo_geomap/urls.py | Omulosi/ngo_geomap | f3d22112f26388db3dfc7239eb540a2f4143cb59 | [
"MIT"
] | null | null | null | """ngo_geomap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | 34.73913 | 77 | 0.703379 | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('office.urls')),
]
| true | true |
f76c8c5209cc08672821f89bc0dbccc3b871108b | 10,872 | py | Python | src/pyrobot/utils/util.py | stuart-fb/pyrobot | 2f06f337f84e2c0b172dcf5ee0cd8c7de73a50e1 | [
"MIT"
] | 6 | 2020-03-08T00:56:25.000Z | 2021-05-21T03:32:37.000Z | src/pyrobot/utils/util.py | stuart-fb/pyrobot | 2f06f337f84e2c0b172dcf5ee0cd8c7de73a50e1 | [
"MIT"
] | null | null | null | src/pyrobot/utils/util.py | stuart-fb/pyrobot | 2f06f337f84e2c0b172dcf5ee0cd8c7de73a50e1 | [
"MIT"
] | 2 | 2022-02-15T21:28:53.000Z | 2022-03-21T21:45:55.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import numpy as np
import rospy
import tf
import geometry_msgs.msg
from geometry_msgs.msg import PoseStamped, Pose
from pyrobot.util... | 34.734824 | 83 | 0.578274 |
import sys
import numpy as np
import rospy
import tf
import geometry_msgs.msg
from geometry_msgs.msg import PoseStamped, Pose
from pyrobot.utils.planning_scene_interface import PlanningSceneInterface
def list_to_pose(pose_list):
pose_msg = Pose()
if len(pose_list) == 7:
pose_msg.position.x = pose_l... | true | true |
f76c8c5bd80750dcb54cdfd2d77a096e8eb1e92c | 2,441 | py | Python | lixada.py | ThYpHo0n/BLE_Lixada | 68b0d801b529ea2e0c75ec0e403388a6b088b8e8 | [
"MIT"
] | 1 | 2017-03-25T03:21:10.000Z | 2017-03-25T03:21:10.000Z | lixada.py | ThYpHo0n/BLE_Lixada | 68b0d801b529ea2e0c75ec0e403388a6b088b8e8 | [
"MIT"
] | null | null | null | lixada.py | ThYpHo0n/BLE_Lixada | 68b0d801b529ea2e0c75ec0e403388a6b088b8e8 | [
"MIT"
] | 2 | 2016-09-24T22:25:46.000Z | 2017-03-25T03:30:47.000Z | # Smart Bulb Lixada! Control With Bluez
# Author: Niklas Grebe
# Original Script by: Tony DiCola
#
# This script will cycle a Smart Bulb Lixada! Bluetooth Low Energy light bulb
# through a rainbow of different hues.
#
# Dependencies:
# - You must install the pexpect library, typically with 'sudo pip install pexpect'.
#... | 36.432836 | 84 | 0.692339 | import colorsys
import math
import sys
import time
import pexpect
HUE_RANGE = (0.0, 1.0) SATURATION = 1.0 VALUE = 1.0 CYCLE_SEC = 5.0 SLEEP_SEC = 0.05
if len(sys.argv) != 2:
print 'Error must specify bulb address as parameter!'
print 'Usage: sudo python lixada.py <bulb address>'
print 'Example: sudo... | false | true |
f76c8cd4092ab61543f82b4e87e854a5c5a7ff5c | 1,282 | py | Python | app/app.py | dubbracer/demo-app-ecs | c1ab5cc764a309da6d2258f7d544e4e78d8b2474 | [
"MIT"
] | null | null | null | app/app.py | dubbracer/demo-app-ecs | c1ab5cc764a309da6d2258f7d544e4e78d8b2474 | [
"MIT"
] | null | null | null | app/app.py | dubbracer/demo-app-ecs | c1ab5cc764a309da6d2258f7d544e4e78d8b2474 | [
"MIT"
] | null | null | null | import urllib
import platform
import random
import requests
import os
from flask import Flask, render_template, url_for, request
from flask import jsonify
app = Flask(__name__)
event_text = 'Demo app for ECS'
print(event_text)
@app.route('/')
def index():
images = [
url_for('static', filename='beachops... | 25.137255 | 156 | 0.655226 | import urllib
import platform
import random
import requests
import os
from flask import Flask, render_template, url_for, request
from flask import jsonify
app = Flask(__name__)
event_text = 'Demo app for ECS'
print(event_text)
@app.route('/')
def index():
images = [
url_for('static', filename='beachops... | true | true |
f76c8cda4bded1b18aee0e447ec5f8548d4f422a | 571 | py | Python | lib/python2.7/site-packages/pyscope/findDLL.py | leschzinerlab/myami-3.2-freeHand | 974b8a48245222de0d9cfb0f433533487ecce60d | [
"MIT"
] | null | null | null | lib/python2.7/site-packages/pyscope/findDLL.py | leschzinerlab/myami-3.2-freeHand | 974b8a48245222de0d9cfb0f433533487ecce60d | [
"MIT"
] | null | null | null | lib/python2.7/site-packages/pyscope/findDLL.py | leschzinerlab/myami-3.2-freeHand | 974b8a48245222de0d9cfb0f433533487ecce60d | [
"MIT"
] | 1 | 2019-09-05T20:58:37.000Z | 2019-09-05T20:58:37.000Z | #!/usr/bin/env python
from win32com.client import selecttlb
items = selecttlb.EnumTlbs()
def getDescsFromTlb():
return map((lambda x: x.desc), items)
print 'Enter a part of string you want to search in description of dll items: '
search_string = raw_input(': ')
if not search_string:
print 'No... | 24.826087 | 80 | 0.630473 |
from win32com.client import selecttlb
items = selecttlb.EnumTlbs()
def getDescsFromTlb():
return map((lambda x: x.desc), items)
print 'Enter a part of string you want to search in description of dll items: '
search_string = raw_input(': ')
if not search_string:
print 'Nothing entered'
else: ... | false | true |
f76c8e58eeb8d63cafaf2f0d0a2df6cfd41bc49c | 7,513 | py | Python | pg_modules/discriminator.py | autonomousvision/stylegan_xl | 8c76531bcbf0931c295ecd1d32f75af998d1411f | [
"MIT"
] | 214 | 2022-02-02T02:24:57.000Z | 2022-03-31T18:39:55.000Z | pg_modules/discriminator.py | autonomousvision/stylegan_xl | 8c76531bcbf0931c295ecd1d32f75af998d1411f | [
"MIT"
] | 8 | 2022-02-03T11:21:10.000Z | 2022-03-31T23:26:24.000Z | pg_modules/discriminator.py | autonomousvision/stylegan_xl | 8c76531bcbf0931c295ecd1d32f75af998d1411f | [
"MIT"
] | 2 | 2022-03-08T08:05:55.000Z | 2022-03-31T23:01:58.000Z | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import Normalize
import pickle
from training.diffaug import DiffAugment
from training.networks_stylegan2 import FullyConnectedLayer
from pg_modules.blocks import conv2d, DownBlock, DownBlockPatch
from pg_m... | 34.463303 | 137 | 0.604153 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import Normalize
import pickle
from training.diffaug import DiffAugment
from training.networks_stylegan2 import FullyConnectedLayer
from pg_modules.blocks import conv2d, DownBlock, DownBlockPatch
from pg_m... | true | true |
f76c8e90d249dc60d84fce26c16b2312b340f627 | 15,525 | py | Python | ormar/fields/foreign_key.py | paolodina/ormar | 64b0004ac6b7120542607c2f19e3342c06d55bcd | [
"MIT"
] | null | null | null | ormar/fields/foreign_key.py | paolodina/ormar | 64b0004ac6b7120542607c2f19e3342c06d55bcd | [
"MIT"
] | null | null | null | ormar/fields/foreign_key.py | paolodina/ormar | 64b0004ac6b7120542607c2f19e3342c06d55bcd | [
"MIT"
] | null | null | null | import sys
import uuid
from dataclasses import dataclass
from typing import Any, List, Optional, TYPE_CHECKING, Tuple, Type, Union
from pydantic import BaseModel, create_model
from pydantic.typing import ForwardRef, evaluate_forwardref
from sqlalchemy import UniqueConstraint
import ormar # noqa I101
from ormar.excep... | 34.423503 | 88 | 0.639871 | import sys
import uuid
from dataclasses import dataclass
from typing import Any, List, Optional, TYPE_CHECKING, Tuple, Type, Union
from pydantic import BaseModel, create_model
from pydantic.typing import ForwardRef, evaluate_forwardref
from sqlalchemy import UniqueConstraint
import ormar from ormar.exceptions import... | true | true |
f76c8f5e2670d9e9b8f7ebed23d6dbc1b8d7fada | 2,729 | py | Python | dataduct/steps/load_redshift.py | hillsdale18/ProjectX | 4518d724eeb8ac73a6eae1d076d4846244e0944a | [
"Apache-2.0"
] | null | null | null | dataduct/steps/load_redshift.py | hillsdale18/ProjectX | 4518d724eeb8ac73a6eae1d076d4846244e0944a | [
"Apache-2.0"
] | null | null | null | dataduct/steps/load_redshift.py | hillsdale18/ProjectX | 4518d724eeb8ac73a6eae1d076d4846244e0944a | [
"Apache-2.0"
] | null | null | null | """
ETL step wrapper for RedshiftCopyActivity to load data into Redshift
"""
from .etl_step import ETLStep
from ..pipeline import RedshiftNode
from ..pipeline import RedshiftCopyActivity
class LoadRedshiftStep(ETLStep):
"""Load Redshift Step class that helps load data into redshift
"""
def __init__(self,... | 35.907895 | 79 | 0.628802 | from .etl_step import ETLStep
from ..pipeline import RedshiftNode
from ..pipeline import RedshiftCopyActivity
class LoadRedshiftStep(ETLStep):
def __init__(self,
schema,
table,
redshift_database,
insert_mode="TRUNCATE",
max_erro... | true | true |
f76c8f790f026fef5238c22cbeba9d9cec8cb7e3 | 1,069 | py | Python | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellMouseEventArgs.py | tranconbv/ironpython-stubs | a601759e6c6819beff8e6b639d18a24b7e351851 | [
"MIT"
] | null | null | null | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellMouseEventArgs.py | tranconbv/ironpython-stubs | a601759e6c6819beff8e6b639d18a24b7e351851 | [
"MIT"
] | null | null | null | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellMouseEventArgs.py | tranconbv/ironpython-stubs | a601759e6c6819beff8e6b639d18a24b7e351851 | [
"MIT"
] | null | null | null | class DataGridViewCellMouseEventArgs(MouseEventArgs):
"""
Provides data for mouse events raised by a System.Windows.Forms.DataGridView whenever the mouse is moved within a System.Windows.Forms.DataGridViewCell.
DataGridViewCellMouseEventArgs(columnIndex: int,rowIndex: int,localX: int,localY: int,e: MouseEven... | 35.633333 | 155 | 0.738073 | class DataGridViewCellMouseEventArgs(MouseEventArgs):
return DataGridViewCellMouseEventArgs()
@staticmethod
def __new__(self,columnIndex,rowIndex,localX,localY,e):
""" __new__(cls: type,columnIndex: int,rowIndex: int,localX: int,localY: int,e: MouseEventArgs) """
pass
"""Gets the zero-based column index ... | true | true |
f76c8feafc3f8caf25dc3ad2755f8707175d6e3d | 2,104 | py | Python | src/kol/manager/FilterManager.py | danheath/temppykol | 7f9621b44df9f9d2d9fc0a5b2a06db116b9ccfab | [
"BSD-3-Clause"
] | 19 | 2015-02-16T08:30:49.000Z | 2020-05-01T06:06:33.000Z | src/kol/manager/FilterManager.py | danheath/temppykol | 7f9621b44df9f9d2d9fc0a5b2a06db116b9ccfab | [
"BSD-3-Clause"
] | 5 | 2015-01-13T23:01:54.000Z | 2016-11-30T15:23:43.000Z | src/kol/manager/FilterManager.py | danheath/temppykol | 7f9621b44df9f9d2d9fc0a5b2a06db116b9ccfab | [
"BSD-3-Clause"
] | 19 | 2015-05-28T09:36:19.000Z | 2022-03-15T23:19:29.000Z | """
This module provides a standard way of registering and executing filter hooks.
"""
# A mapping from eventName to an array of filters.
__filters = {}
# Return codes that can be set by filters.
ABORT = 0
CONTINUE = 1
FINISHED = 2
def registerFilterForEvent(filter, eventName, loadOrder=10):
"""
Registers a ... | 31.878788 | 96 | 0.634506 |
__filters = {}
ABORT = 0
CONTINUE = 1
FINISHED = 2
def registerFilterForEvent(filter, eventName, loadOrder=10):
if eventName in __filters:
filtersForEvent = __filters[eventName]
i = 0
while i < len(filtersForEvent):
if loadOrder >= filtersForEvent[i][1]:
i += 1... | true | true |
f76c90d088f7839543d07c397d1e58ecbf3efda5 | 1,197 | py | Python | murt/utils/object.py | tamsri/murt | 180dbb0d09ab50dfdaa1be843475f20a86651ea2 | [
"MIT"
] | 4 | 2021-06-19T08:38:47.000Z | 2022-01-10T21:10:38.000Z | murt/utils/object.py | tamsri/murt | 180dbb0d09ab50dfdaa1be843475f20a86651ea2 | [
"MIT"
] | 1 | 2021-05-26T12:08:01.000Z | 2021-05-26T12:08:01.000Z | murt/utils/object.py | tamsri/murt | 180dbb0d09ab50dfdaa1be843475f20a86651ea2 | [
"MIT"
] | 2 | 2022-01-24T11:04:46.000Z | 2022-02-23T22:26:42.000Z | import numpy as np
from murt.utils import objreader
import os
import sys
COMPONENT_PATH = os.path.join(sys.prefix, "murt-assets")
class Object():
def __init__(self, object_name, file_path=None, directory_path=None):
self.object_name = object_name
self.scale, self.translate, self.rotate = \
... | 33.25 | 77 | 0.562239 | import numpy as np
from murt.utils import objreader
import os
import sys
COMPONENT_PATH = os.path.join(sys.prefix, "murt-assets")
class Object():
def __init__(self, object_name, file_path=None, directory_path=None):
self.object_name = object_name
self.scale, self.translate, self.rotate = \
... | true | true |
f76c93fd0fdf1d9c8b3594ffb07ef410705ecc83 | 5,841 | py | Python | fairseq/models/cmlm_transformer.py | IIP-Sogang/Audio-Visual-Speech-Recognition | bd03be91135acbc6162b83092d462b7fe71dd007 | [
"MIT"
] | 138 | 2020-10-21T17:45:34.000Z | 2022-03-31T15:44:19.000Z | fairseq/models/cmlm_transformer.py | IIP-Sogang/Audio-Visual-Speech-Recognition | bd03be91135acbc6162b83092d462b7fe71dd007 | [
"MIT"
] | 35 | 2020-11-02T10:53:20.000Z | 2022-03-18T20:58:07.000Z | fairseq/models/cmlm_transformer.py | IIP-Sogang/Audio-Visual-Speech-Recognition | bd03be91135acbc6162b83092d462b7fe71dd007 | [
"MIT"
] | 38 | 2020-11-07T19:23:25.000Z | 2022-03-31T08:56:33.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
This file implements:
Ghazvininejad, Marjan, et al.
"Constant-time machine translation with conditional masked language models."
arXiv pre... | 42.635036 | 88 | 0.722137 |
import torch
from fairseq.models import register_model, register_model_architecture
from fairseq.models.nonautoregressive_transformer import NATransformerModel
def _skeptical_unmasking(output_scores, output_masks, p):
sorted_index = output_scores.sort(-1)[1]
boundary_len = (
(output_masks.sum(1, kee... | true | true |
f76c941ccac5e5839c26c0b8e84aab9122aa1127 | 2,590 | py | Python | ai_chickenpoker/python/chp_bot.py | hilkoc/AI_Arena | 592be09062a4cf02f2b153e3c2e5afc7ca15d084 | [
"MIT"
] | 35 | 2017-05-29T04:25:20.000Z | 2021-10-03T22:43:57.000Z | ai_chickenpoker/python/chp_bot.py | hilkoc/AI_Arena | 592be09062a4cf02f2b153e3c2e5afc7ca15d084 | [
"MIT"
] | null | null | null | ai_chickenpoker/python/chp_bot.py | hilkoc/AI_Arena | 592be09062a4cf02f2b153e3c2e5afc7ca15d084 | [
"MIT"
] | 1 | 2019-03-05T03:38:17.000Z | 2019-03-05T03:38:17.000Z | """ Chicken Poker random bot. """
import logging
logging.basicConfig(filename='chp_bot.log', level=logging.DEBUG, filemode='w')
log = logging.getLogger(__name__)
log.info("Starting")
#
# Networking
#
import sys
def deserialize_round(round_string):
""" param: round_string is expected to be list of integers sep... | 22.719298 | 103 | 0.595367 |
import logging
logging.basicConfig(filename='chp_bot.log', level=logging.DEBUG, filemode='w')
log = logging.getLogger(__name__)
log.info("Starting")
import sys
def deserialize_round(round_string):
log.debug("round_string %s", round_string)
last_round = dict()
parts = round_string.strip().split(" ")
... | true | true |
f76c9424a299d9d97337a4c7ed5845babab02ff5 | 356 | py | Python | jupyter_notebook_config.py | itamaro/CADL | b5de17485962577fc51156cd12da1b16d66dbb26 | [
"Apache-2.0"
] | 1,628 | 2016-07-19T22:21:56.000Z | 2022-02-27T15:19:45.000Z | jupyter_notebook_config.py | itamaro/CADL | b5de17485962577fc51156cd12da1b16d66dbb26 | [
"Apache-2.0"
] | 75 | 2016-07-22T02:05:05.000Z | 2019-05-20T21:00:34.000Z | jupyter_notebook_config.py | itamaro/CADL | b5de17485962577fc51156cd12da1b16d66dbb26 | [
"Apache-2.0"
] | 955 | 2016-07-22T00:10:52.000Z | 2022-02-24T15:06:09.000Z | import os
from IPython.lib import passwd
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python3'
# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
c.NotebookApp.password = passwd(os.environ['PASSWOR... | 27.384615 | 59 | 0.758427 | import os
from IPython.lib import passwd
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python3'
if 'PASSWORD' in os.environ:
c.NotebookApp.password = passwd(os.environ['PASSWORD'])
del os.environ['PASSWORD']
| true | true |
f76c9451347ce7186559cab9802a39b30e79f102 | 120 | py | Python | math_in_programming/03_geometric-sequence-and-arithmetic-sequence/03-08.py | fumiyanll23/algo-method | d86ea1d399cbc5a1db0ae49d0c82e41042f661ab | [
"MIT"
] | null | null | null | math_in_programming/03_geometric-sequence-and-arithmetic-sequence/03-08.py | fumiyanll23/algo-method | d86ea1d399cbc5a1db0ae49d0c82e41042f661ab | [
"MIT"
] | null | null | null | math_in_programming/03_geometric-sequence-and-arithmetic-sequence/03-08.py | fumiyanll23/algo-method | d86ea1d399cbc5a1db0ae49d0c82e41042f661ab | [
"MIT"
] | null | null | null | # input
N, X, r = map(int, input().split())
MOD = pow(10, 9)
# compute
# output
print(X * (pow(r, N, MOD) - 1) % MOD)
| 13.333333 | 37 | 0.533333 | N, X, r = map(int, input().split())
MOD = pow(10, 9)
print(X * (pow(r, N, MOD) - 1) % MOD)
| true | true |
f76c94ba64216bdedf3ab635d58ed2e264b7908e | 116 | py | Python | gym_snake/__init__.py | apat1n/gym-snake | 1137296cc142f7529217024ecbd2739d57f606b5 | [
"MIT"
] | 1 | 2019-06-23T15:59:28.000Z | 2019-06-23T15:59:28.000Z | gym_snake/__init__.py | Grennwolf/gym-snake | 1137296cc142f7529217024ecbd2739d57f606b5 | [
"MIT"
] | null | null | null | gym_snake/__init__.py | Grennwolf/gym-snake | 1137296cc142f7529217024ecbd2739d57f606b5 | [
"MIT"
] | null | null | null | from gym.envs.registration import register
register(id='snake-v0',
entry_point='gym_snake.envs:SnakeEnv')
| 23.2 | 47 | 0.741379 | from gym.envs.registration import register
register(id='snake-v0',
entry_point='gym_snake.envs:SnakeEnv')
| true | true |
f76c94e69fad2ecc8272012bb9f677c7c716fc99 | 21,471 | py | Python | wins/tests/test_wins_datahub_view.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 5 | 2016-09-12T12:52:45.000Z | 2020-03-24T14:43:13.000Z | wins/tests/test_wins_datahub_view.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 435 | 2016-10-18T12:51:39.000Z | 2021-06-09T17:22:08.000Z | wins/tests/test_wins_datahub_view.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 2 | 2016-12-06T10:37:21.000Z | 2017-02-22T17:27:43.000Z | from django.urls import reverse
from django.utils.http import urlencode
from fixturedb.factories.win import create_win_factory
import pytest
from rest_framework import status
from test_helpers.hawk_utils import hawk_auth_sender as _hawk_auth_sender
from wins.constants import BUSINESS_POTENTIAL, HQ_TEAM_REGION_OR_P... | 38.616906 | 90 | 0.481626 | from django.urls import reverse
from django.utils.http import urlencode
from fixturedb.factories.win import create_win_factory
import pytest
from rest_framework import status
from test_helpers.hawk_utils import hawk_auth_sender as _hawk_auth_sender
from wins.constants import BUSINESS_POTENTIAL, HQ_TEAM_REGION_OR_P... | true | true |
f76c94e825138d3fcedd3ea26c38ff9d8eb190a6 | 157 | py | Python | 2021/Day14/day14.py | dh256/adventofcode | 428eec13f4cbf153333a0e359bcff23070ef6d27 | [
"MIT"
] | null | null | null | 2021/Day14/day14.py | dh256/adventofcode | 428eec13f4cbf153333a0e359bcff23070ef6d27 | [
"MIT"
] | null | null | null | 2021/Day14/day14.py | dh256/adventofcode | 428eec13f4cbf153333a0e359bcff23070ef6d27 | [
"MIT"
] | null | null | null | from polymer import Polymer
poly = Polymer('input.txt')
print(f'Part 1: {poly.element_difference2(10)}')
print(f'Part 2: {poly.element_difference2(40)}')
| 19.625 | 48 | 0.732484 | from polymer import Polymer
poly = Polymer('input.txt')
print(f'Part 1: {poly.element_difference2(10)}')
print(f'Part 2: {poly.element_difference2(40)}')
| true | true |
f76c961191e1addd48a9e35b3839abec17368ed2 | 2,117 | py | Python | octavia/tests/unit/common/test_utils.py | Sirius21c/octavia | e7057a566689967f23ede519235d6075a01a6d61 | [
"Apache-2.0"
] | 1 | 2019-01-11T06:18:38.000Z | 2019-01-11T06:18:38.000Z | octavia/tests/unit/common/test_utils.py | Sirius21c/octavia | e7057a566689967f23ede519235d6075a01a6d61 | [
"Apache-2.0"
] | null | null | null | octavia/tests/unit/common/test_utils.py | Sirius21c/octavia | e7057a566689967f23ede519235d6075a01a6d61 | [
"Apache-2.0"
] | null | null | null | # Copyright 2014, Doug Wiegley, A10 Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 41.509804 | 78 | 0.668399 |
import octavia.common.utils as utils
import octavia.tests.unit.base as base
class TestConfig(base.TestCase):
def test_get_hostname(self):
self.assertNotEqual(utils.get_hostname(), '')
def test_is_ipv6(self):
self.assertFalse(utils.is_ipv6('192.0.2.10'))
self.assertFalse(utils.is_ipv... | true | true |
f76c9627be93ead373f4b81741c099e6a757716b | 5,941 | py | Python | us-census/mysql/db_loader.py | UA-SRC-data/data_loaders | 4a6751358f5771d8702c0152af01fbd81bab9ffb | [
"MIT"
] | 1 | 2020-04-03T17:40:57.000Z | 2020-04-03T17:40:57.000Z | us-census/mysql/db_loader.py | UA-SRC-data/data_loaders | 4a6751358f5771d8702c0152af01fbd81bab9ffb | [
"MIT"
] | 11 | 2020-11-12T23:54:52.000Z | 2022-01-11T04:42:33.000Z | us-census/mysql/db_loader.py | UA-SRC-data/data_loaders | 4a6751358f5771d8702c0152af01fbd81bab9ffb | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Author : Ken Youens-Clark <kyclark@gmail.com>
Date : 2020-02-07
Purpose: Load "data_with_overlays" into SQLite
"""
import argparse
import configparser
import csv
import os
import re
import mysql.connector
import sys
from pprint import pprint
# --------------------------------------------... | 27.37788 | 81 | 0.501094 |
import argparse
import configparser
import csv
import os
import re
import mysql.connector
import sys
from pprint import pprint
def get_args():
parser = argparse.ArgumentParser(
description='Load "data_with_overlays" into MySQL',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser... | true | true |
f76c977c60894948abb1e5cc4829bcfaff4a74ea | 3,248 | py | Python | ros/src/tl_detector/light_classification/tl_classifier.py | Chrasmus/SDCN_July18_T3_P3_CapStone_System_Integration | b64e01a0202adb4a6d82c2a598756a07e585fcbb | [
"MIT"
] | 1 | 2021-07-03T07:10:58.000Z | 2021-07-03T07:10:58.000Z | ros/src/tl_detector/light_classification/tl_classifier.py | Chrasmus/SDCN_July18_T3_P3_CapStone_System_Integration | b64e01a0202adb4a6d82c2a598756a07e585fcbb | [
"MIT"
] | null | null | null | ros/src/tl_detector/light_classification/tl_classifier.py | Chrasmus/SDCN_July18_T3_P3_CapStone_System_Integration | b64e01a0202adb4a6d82c2a598756a07e585fcbb | [
"MIT"
] | null | null | null | from styx_msgs.msg import TrafficLight
import tensorflow as tf
import numpy as np
class TLClassifier(object):
def __init__(self, is_site):
#TODO load classifier
# main code source : object_detection_tutorial.ipynb from Google's model-zoo on GitHub
if is_site:
PATH_TO_FROZEN_GRAP... | 47.764706 | 160 | 0.627155 | from styx_msgs.msg import TrafficLight
import tensorflow as tf
import numpy as np
class TLClassifier(object):
def __init__(self, is_site):
if is_site:
PATH_TO_FROZEN_GRAPH = r'/home/workspace/CarND-Capstone/frozen_models/frozen_site_inception/frozen_inference_graph.pb'
e... | true | true |
f76c97eef354283aecc2300158846f981c491d31 | 285 | py | Python | tms_ss/tms_ss_nfbed/scripts/config.py | robotpilot/ros_tms | 3d6b6579e89aa9cb216cd3cb6157fabc553c18f1 | [
"BSD-3-Clause"
] | 54 | 2015-01-06T06:58:28.000Z | 2021-05-02T07:49:37.000Z | tms_ss/tms_ss_nfbed/scripts/config.py | robotpilot/ros_tms | 3d6b6579e89aa9cb216cd3cb6157fabc553c18f1 | [
"BSD-3-Clause"
] | 114 | 2015-01-07T06:42:21.000Z | 2022-02-12T05:54:04.000Z | tms_ss/tms_ss_nfbed/scripts/config.py | robotpilot/ros_tms | 3d6b6579e89aa9cb216cd3cb6157fabc553c18f1 | [
"BSD-3-Clause"
] | 24 | 2015-03-27T08:35:59.000Z | 2020-06-08T13:05:31.000Z | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: https://github.com/kazuto1011
# Created: 2016-06-07
config = {
'server_IP': '192.168.4.170',
'PORT': 49952,
'xml_file': 'C:/Users/nemuriscan/Desktop/NemuriScanLog/NemuriScanStateInfo.xml'
}
| 21.923077 | 83 | 0.659649 |
config = {
'server_IP': '192.168.4.170',
'PORT': 49952,
'xml_file': 'C:/Users/nemuriscan/Desktop/NemuriScanLog/NemuriScanStateInfo.xml'
}
| true | true |
f76c988ccd8844ca9c053039eefe72c5e3c31014 | 691 | py | Python | homeassistant/components/epson_monitor/const.py | samsunga3888/hass | 496916043d8fa6c8e44323030e46c49f825ab70c | [
"Apache-2.0"
] | null | null | null | homeassistant/components/epson_monitor/const.py | samsunga3888/hass | 496916043d8fa6c8e44323030e46c49f825ab70c | [
"Apache-2.0"
] | null | null | null | homeassistant/components/epson_monitor/const.py | samsunga3888/hass | 496916043d8fa6c8e44323030e46c49f825ab70c | [
"Apache-2.0"
] | null | null | null | """Constants for the epson integration."""
DOMAIN = "epson_monitor"
SERVICE_SELECT_CMODE = "select_cmode"
ATTR_CMODE = "cmode"
HTTP = "http"
#URL = "http://10.129.101.4:8123/api/states/switch.pei_xun_shi_tou_ying_ji_dian_yuan_socket_1"
URL = "http://10.129.101.4:8123/api/states/switch.15ceng_pei_xun_shi_wi_fizhi_nen... | 40.647059 | 214 | 0.816208 |
DOMAIN = "epson_monitor"
SERVICE_SELECT_CMODE = "select_cmode"
ATTR_CMODE = "cmode"
HTTP = "http"
URL = "http://10.129.101.4:8123/api/states/switch.15ceng_pei_xun_shi_wi_fizhi_neng_liu_kong_ji_liang_pai_cha_socket_3"
HEADERS = {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxN2Q0ZGU3Y... | true | true |
f76c9950a5b0b66b3be1846cb86b38872b7874d9 | 3,641 | py | Python | app/backend/Scripts/Transformer.py | zihanzawad/Blockchain-Project | 94d4542fce7653dcb95d13fe6a3951160e3defd2 | [
"MIT"
] | 1 | 2021-08-07T12:45:31.000Z | 2021-08-07T12:45:31.000Z | app/backend/Scripts/Transformer.py | zihanzawad/Blockchain-Project | 94d4542fce7653dcb95d13fe6a3951160e3defd2 | [
"MIT"
] | 29 | 2021-08-08T03:48:59.000Z | 2021-10-20T23:22:34.000Z | app/backend/Scripts/Transformer.py | zihanzawad/Blockchain-Project | 94d4542fce7653dcb95d13fe6a3951160e3defd2 | [
"MIT"
] | 1 | 2021-08-14T19:28:14.000Z | 2021-08-14T19:28:14.000Z | from pdf2image import convert_from_path, convert_from_bytes
from os import path, makedirs
from hashlib import sha256
import numpy as np
import base64
class Transformer():
#read pdf from file path and convert to jpegs
def save_pdf_as_image(inputPath:str, outputPath:str):
if not path.exists(outputPath)... | 34.67619 | 84 | 0.642406 | from pdf2image import convert_from_path, convert_from_bytes
from os import path, makedirs
from hashlib import sha256
import numpy as np
import base64
class Transformer():
def save_pdf_as_image(inputPath:str, outputPath:str):
if not path.exists(outputPath):
makedirs(outputPath)
pd... | true | true |
f76c9a76396a625d11386e112550302f9986220c | 1,348 | py | Python | traits_futures/i_event_loop.py | enthought/traits-futures | 4b20376d95e83a76d77ce10e024ec4527c27d5d0 | [
"BSD-3-Clause"
] | 10 | 2019-02-08T15:52:18.000Z | 2021-12-14T03:13:41.000Z | traits_futures/i_event_loop.py | enthought/traits-futures | 4b20376d95e83a76d77ce10e024ec4527c27d5d0 | [
"BSD-3-Clause"
] | 244 | 2019-02-05T17:18:15.000Z | 2022-03-12T10:55:20.000Z | traits_futures/i_event_loop.py | enthought/traits-futures | 4b20376d95e83a76d77ce10e024ec4527c27d5d0 | [
"BSD-3-Clause"
] | 1 | 2021-07-06T07:18:21.000Z | 2021-07-06T07:18:21.000Z | # (C) Copyright 2018-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | 25.433962 | 78 | 0.641691 |
import abc
class IEventLoop(abc.ABC):
@abc.abstractmethod
def pingee(self, on_ping):
@abc.abstractmethod
def helper(self):
| true | true |
f76c9bb2975e90e7599bd472397180075bd264a6 | 873 | py | Python | python/test/test_custom_name.py | dlens/dlxapi | 189a6519240ce625d7a9cdb89e305a335d2aa045 | [
"MIT"
] | null | null | null | python/test/test_custom_name.py | dlens/dlxapi | 189a6519240ce625d7a9cdb89e305a335d2aa045 | [
"MIT"
] | 1 | 2020-08-20T17:31:43.000Z | 2020-08-20T17:31:43.000Z | python/test/test_custom_name.py | dlens/dlxapi | 189a6519240ce625d7a9cdb89e305a335d2aa045 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Decision Lens API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... | 21.292683 | 119 | 0.688431 |
from __future__ import absolute_import
import unittest
import dlxapi
from dlxapi.models.custom_name import CustomName from dlxapi.rest import ApiException
class TestCustomName(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testCustomName(self):
... | true | true |
f76c9ce2787bc288d2064d60b155330568381e0b | 588 | py | Python | data-structures/tree/bfs.py | AlaminMahamud/python-cheatsheet | e3acb70d80cd95845fee4d3457891886c27d8c63 | [
"MIT"
] | 1 | 2021-03-10T14:37:23.000Z | 2021-03-10T14:37:23.000Z | data-structures/tree/bfs.py | anika26452/awesome-python | a0b08d6078f6daa0c44aa66e56b59caa69c13929 | [
"MIT"
] | 5 | 2020-02-12T01:23:06.000Z | 2021-05-07T21:57:14.000Z | data-structures/tree/bfs.py | anika26452/awesome-python | a0b08d6078f6daa0c44aa66e56b59caa69c13929 | [
"MIT"
] | 3 | 2019-01-11T19:47:06.000Z | 2021-03-10T14:37:20.000Z | class Node:
def __init__(self, key):
self.key, self.left, self.right = key, None, None
def bfs(node):
if not node:
return
q = []
q.append(node)
while len(q):
temp = q.pop(0)
if temp.left:
q.append(temp.left)
if temp.right:
q.append(... | 18.967742 | 57 | 0.530612 | class Node:
def __init__(self, key):
self.key, self.left, self.right = key, None, None
def bfs(node):
if not node:
return
q = []
q.append(node)
while len(q):
temp = q.pop(0)
if temp.left:
q.append(temp.left)
if temp.right:
q.append(... | true | true |
f76c9d6b8b67d74f6879fee1717486a0ed5be470 | 7,205 | py | Python | python_modules/dagster/dagster_tests/core_tests/runtime_types_tests/test_runtime_types.py | naralogics/dagster | 16d599daa380b800149474fcaff2311b3f8f269a | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster_tests/core_tests/runtime_types_tests/test_runtime_types.py | naralogics/dagster | 16d599daa380b800149474fcaff2311b3f8f269a | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster_tests/core_tests/runtime_types_tests/test_runtime_types.py | naralogics/dagster | 16d599daa380b800149474fcaff2311b3f8f269a | [
"Apache-2.0"
] | null | null | null | import pytest
from dagster import (
Any,
Bool,
DagsterInvalidDefinitionError,
Dict,
Float,
InputDefinition,
Int,
List,
Nothing,
Optional,
OutputDefinition,
Path,
PipelineDefinition,
Set,
String,
Tuple,
lambda_solid,
pipeline,
)
from dagster.core.t... | 36.573604 | 95 | 0.728105 | import pytest
from dagster import (
Any,
Bool,
DagsterInvalidDefinitionError,
Dict,
Float,
InputDefinition,
Int,
List,
Nothing,
Optional,
OutputDefinition,
Path,
PipelineDefinition,
Set,
String,
Tuple,
lambda_solid,
pipeline,
)
from dagster.core.t... | true | true |
f76c9dd2bdb113e279cf6decf94c8d16f86a0c2e | 11,174 | py | Python | climateeconomics/tests/witness_jacobian_disc_test.py | os-climate/witness-core | 3ef9a44d86804c5ad57deec3c9916348cb3bfbb8 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2022-01-14T06:37:42.000Z | 2022-01-14T06:37:42.000Z | climateeconomics/tests/witness_jacobian_disc_test.py | os-climate/witness-core | 3ef9a44d86804c5ad57deec3c9916348cb3bfbb8 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | climateeconomics/tests/witness_jacobian_disc_test.py | os-climate/witness-core | 3ef9a44d86804c5ad57deec3c9916348cb3bfbb8 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | '''
Copyright 2022 Airbus SAS
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
dis... | 47.548936 | 113 | 0.553696 |
import climateeconomics.tests as jacobian_target
from os.path import join, dirname, exists
from sos_trades_core.tests.core.abstract_jacobian_unit_test import AbstractJacobianUnittest
from tqdm import tqdm
import platform
class WitnessJacobianDiscTest(AbstractJacobianUnittest):
PARALLEL = False
if platfo... | true | true |
f76c9eef55841dc2c5588fac12c8c9cf51e4fad8 | 4,806 | py | Python | .config/tar.py | yardenac/forkpanel | b21a83bb96a07b1d4d1c6d0f730f8a61ebe6d97b | [
"MIT"
] | 49 | 2015-12-04T07:41:16.000Z | 2022-03-29T18:39:19.000Z | .config/tar.py | yardenac/forkpanel | b21a83bb96a07b1d4d1c6d0f730f8a61ebe6d97b | [
"MIT"
] | 52 | 2015-12-03T11:15:52.000Z | 2021-12-19T10:23:32.000Z | .config/tar.py | yardenac/forkpanel | b21a83bb96a07b1d4d1c6d0f730f8a61ebe6d97b | [
"MIT"
] | 31 | 2015-12-04T08:02:22.000Z | 2021-05-14T10:41:02.000Z | #!/usr/bin/python
import subprocess as sp
import re, tempfile
import shutil, os, sys
##################################################
# Loging
import logging
def _init_log():
name = 'app'
x = logging.getLogger(name)
x.setLevel(logging.WARNING)
# x.setLevel(logging.DEBUG)
h = logging.StreamHandle... | 26.849162 | 80 | 0.560549 |
import subprocess as sp
import re, tempfile
import shutil, os, sys
import logging
def _init_log():
name = 'app'
x = logging.getLogger(name)
x.setLevel(logging.WARNING)
h = logging.StreamHandler()
f = logging.Formatter("%(message)s")
h.setFormatter(f)
x.addHandler(h)
return x
x... | true | true |
f76c9f28f46f84b74b78dad1e208c999cb6237e7 | 5,269 | py | Python | chemfp/slow.py | flc/chem-fingerprints | 8c1b27374355f08105c5332db376b3428b6e30b2 | [
"MIT"
] | null | null | null | chemfp/slow.py | flc/chem-fingerprints | 8c1b27374355f08105c5332db376b3428b6e30b2 | [
"MIT"
] | null | null | null | chemfp/slow.py | flc/chem-fingerprints | 8c1b27374355f08105c5332db376b3428b6e30b2 | [
"MIT"
] | null | null | null | import heapq
import operator
from . import bitops
from . import Fingerprints
def count_tanimoto_hits_fp(query_fp, targets, threshold):
return sum(1 for target in targets
if bitops.byte_tanimoto(query_fp, target[1]) >= threshold)
## def iter_count_tanimoto_hits(queries, targets, threshold):
## ... | 40.844961 | 115 | 0.667489 | import heapq
import operator
from . import bitops
from . import Fingerprints
def count_tanimoto_hits_fp(query_fp, targets, threshold):
return sum(1 for target in targets
if bitops.byte_tanimoto(query_fp, target[1]) >= threshold)
def count_tanimoto_hits(queries, targets, threshold):
result... | true | true |
f76ca04d103381750869dc80fbc1809a6afa6678 | 1,062 | py | Python | 19_remove_nth_node.py | solarknight/leetcode_solutions_python | b622498159370503f1d909d70102c884439967f9 | [
"MIT"
] | null | null | null | 19_remove_nth_node.py | solarknight/leetcode_solutions_python | b622498159370503f1d909d70102c884439967f9 | [
"MIT"
] | null | null | null | 19_remove_nth_node.py | solarknight/leetcode_solutions_python | b622498159370503f1d909d70102c884439967f9 | [
"MIT"
] | null | null | null | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
l, p = [self.val], self.next
while (p != None):
l.append(p.val)
p = p.next
return str(l)
class Solution:
def removeN... | 25.902439 | 67 | 0.532957 | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
l, p = [self.val], self.next
while (p != None):
l.append(p.val)
p = p.next
return str(l)
class Solution:
def removeNthFromEnd(self, head: ListNode, n: in... | true | true |
f76ca0d36a94a02b5bd0ed9b48028165852284b0 | 839 | py | Python | chapter02/dags/listing_2_4.py | ratthaslip/data-pipelines-with-apache-airflow | 1813c5b09552826c1bcb6edf4b9e4c0ff510a243 | [
"BSD-Source-Code"
] | null | null | null | chapter02/dags/listing_2_4.py | ratthaslip/data-pipelines-with-apache-airflow | 1813c5b09552826c1bcb6edf4b9e4c0ff510a243 | [
"BSD-Source-Code"
] | null | null | null | chapter02/dags/listing_2_4.py | ratthaslip/data-pipelines-with-apache-airflow | 1813c5b09552826c1bcb6edf4b9e4c0ff510a243 | [
"BSD-Source-Code"
] | null | null | null |
import json
import pathlib
import requests
import requests.exceptions as requests_exceptions
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.operators.bash_operator import BashOperator
default_args = {
'owner': 'airflo... | 24.676471 | 115 | 0.736591 |
import json
import pathlib
import requests
import requests.exceptions as requests_exceptions
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.operators.bash_operator import BashOperator
default_args = {
'owner': 'airflo... | false | true |
f76ca0d439ad395933ac461dcae04a5b3010c34d | 13,628 | py | Python | model-optimizer/mo/utils/unittest/graph.py | rgarnov/openvino | a864c2eb85e5649770ee0172080b250efab8c97e | [
"Apache-2.0"
] | null | null | null | model-optimizer/mo/utils/unittest/graph.py | rgarnov/openvino | a864c2eb85e5649770ee0172080b250efab8c97e | [
"Apache-2.0"
] | 1 | 2021-07-24T15:22:27.000Z | 2021-07-24T15:22:27.000Z | model-optimizer/mo/utils/unittest/graph.py | rgarnov/openvino | a864c2eb85e5649770ee0172080b250efab8c97e | [
"Apache-2.0"
] | 1 | 2020-08-13T08:33:55.000Z | 2020-08-13T08:33:55.000Z | """
Copyright (C) 2018-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | 42.454829 | 124 | 0.66334 | from argparse import Namespace
from copy import deepcopy
import networkx as nx
from mo.front.common.partial_infer.utils import int64_array
from mo.front.extractor import extract_port_from_string
from mo.graph.graph import Node, Graph
from mo.middle.pattern_match import all_edges_in_nodes
from mo.ops.const import Cons... | true | true |
f76ca12dfa3779efd7a9d5647adef8025e825cc7 | 2,473 | py | Python | syllabus/classes/class7/main.py | rmxrmx/NLP-E21 | ac91c63efab889c17a1079e4105f5c95ba19e2ef | [
"MIT"
] | 11 | 2021-09-01T12:48:17.000Z | 2021-09-09T13:00:36.000Z | syllabus/classes/class7/main.py | AnaCollados/NLP-E21 | fd5c3af70a2434cc30a3ffb52e4e0872cbffdd23 | [
"MIT"
] | null | null | null | syllabus/classes/class7/main.py | AnaCollados/NLP-E21 | fd5c3af70a2434cc30a3ffb52e4e0872cbffdd23 | [
"MIT"
] | 22 | 2021-09-06T10:16:30.000Z | 2022-01-30T13:17:58.000Z | import numpy as np
import torch
from datasets import load_dataset
import gensim.downloader as api
from util import batch
from LSTM import RNN
from embedding import gensim_to_torch_embedding
# DATASET
dataset = load_dataset("conllpp")
train = dataset["train"]
# inspect the dataset
train["tokens"][:1]
train["ner_tags... | 27.786517 | 111 | 0.752123 | import numpy as np
import torch
from datasets import load_dataset
import gensim.downloader as api
from util import batch
from LSTM import RNN
from embedding import gensim_to_torch_embedding
dataset = load_dataset("conllpp")
train = dataset["train"]
train["tokens"][:1]
train["ner_tags"][:1]
num_classes = train.featu... | true | true |
f76ca1e350d2351a111768d58836f7d546ce2dc8 | 685 | bzl | Python | github.com/grpc/grpc-web/defs.bzl | kalbasit/rules_proto_grpc | 7e0a97adc8801df1cd74ee435d74bbd857c98a36 | [
"Apache-2.0"
] | 1 | 2021-08-11T23:14:07.000Z | 2021-08-11T23:14:07.000Z | github.com/grpc/grpc-web/defs.bzl | kalbasit/rules_proto_grpc | 7e0a97adc8801df1cd74ee435d74bbd857c98a36 | [
"Apache-2.0"
] | null | null | null | github.com/grpc/grpc-web/defs.bzl | kalbasit/rules_proto_grpc | 7e0a97adc8801df1cd74ee435d74bbd857c98a36 | [
"Apache-2.0"
] | null | null | null | # Aggregate all `grpc-web` rules to one loadable file
load(":closure_grpc_compile.bzl", _closure_grpc_compile="closure_grpc_compile")
load(":commonjs_grpc_compile.bzl", _commonjs_grpc_compile="commonjs_grpc_compile")
load(":commonjs_dts_grpc_compile.bzl", _commonjs_dts_grpc_compile="commonjs_dts_grpc_compile")
load(":t... | 52.692308 | 94 | 0.862774 | load(":closure_grpc_compile.bzl", _closure_grpc_compile="closure_grpc_compile")
load(":commonjs_grpc_compile.bzl", _commonjs_grpc_compile="commonjs_grpc_compile")
load(":commonjs_dts_grpc_compile.bzl", _commonjs_dts_grpc_compile="commonjs_dts_grpc_compile")
load(":ts_grpc_compile.bzl", _ts_grpc_compile="ts_grpc_compile... | true | true |
f76ca2526c65fb7b51e96445220f9efb745dab6c | 4,376 | py | Python | py-simple-hybrid/nnet.py | SrikarSiddarth/stanford-ctc | c8f8257227ec218c4794a96a089ef0a093dcbdfd | [
"Apache-2.0"
] | 268 | 2015-06-15T20:59:49.000Z | 2021-12-26T15:05:50.000Z | py-simple-hybrid/nnet.py | guker/stanford-ctc | 3d3bd9ce92cfdc0173b1bd2096ecea8634d6b62f | [
"Apache-2.0"
] | 16 | 2015-06-16T03:22:31.000Z | 2019-12-11T15:58:57.000Z | py-simple-hybrid/nnet.py | guker/stanford-ctc | 3d3bd9ce92cfdc0173b1bd2096ecea8634d6b62f | [
"Apache-2.0"
] | 109 | 2015-07-07T15:36:22.000Z | 2021-07-28T03:48:15.000Z |
import gnumpy as gp
import numpy as np
def relu_hard(x, computeGrad = False):
if (not computeGrad):
f = (1/2.)*(x+gp.sign(x)*x)
return f
g = gp.sign(x)
return g
def relu(x, computeGrad = False):
negslope = .01
a = (1+negslope)/2.; b = (1-negslope)/2.
if (not computeGrad):
... | 30.17931 | 90 | 0.558958 |
import gnumpy as gp
import numpy as np
def relu_hard(x, computeGrad = False):
if (not computeGrad):
f = (1/2.)*(x+gp.sign(x)*x)
return f
g = gp.sign(x)
return g
def relu(x, computeGrad = False):
negslope = .01
a = (1+negslope)/2.; b = (1-negslope)/2.
if (not computeGrad):
... | false | true |
f76ca33b0a4627b2fa356bd2c20fefa1bbf2fb33 | 10,448 | py | Python | gridworld_vav/experiments/basic_value_alignment/gaussian_reward_value_alignment_experiment_runner_diffmethods_arp.py | dsbrown1331/vav-icml | 90f40c2b5b52f3cc142ffd4e02bb82d88e1e221d | [
"MIT"
] | null | null | null | gridworld_vav/experiments/basic_value_alignment/gaussian_reward_value_alignment_experiment_runner_diffmethods_arp.py | dsbrown1331/vav-icml | 90f40c2b5b52f3cc142ffd4e02bb82d88e1e221d | [
"MIT"
] | null | null | null | gridworld_vav/experiments/basic_value_alignment/gaussian_reward_value_alignment_experiment_runner_diffmethods_arp.py | dsbrown1331/vav-icml | 90f40c2b5b52f3cc142ffd4e02bb82d88e1e221d | [
"MIT"
] | null | null | null | #I want to rerun things with the ARP rather than the AEC...
import sys
import os
exp_path = os.path.dirname(os.path.abspath(__file__))
print(exp_path)
project_path = os.path.abspath(os.path.join(exp_path, "..", ".."))
sys.path.insert(0, project_path)
print(sys.path)
import src.experiment_utils as eutils
import src.ut... | 45.824561 | 195 | 0.60557 |
import sys
import os
exp_path = os.path.dirname(os.path.abspath(__file__))
print(exp_path)
project_path = os.path.abspath(os.path.join(exp_path, "..", ".."))
sys.path.insert(0, project_path)
print(sys.path)
import src.experiment_utils as eutils
import src.utils as utils
import src.mdp as mdp
import src.machine_teachi... | true | true |
f76ca3680df87e3fb1fb8ba58a6f9c853b69f327 | 1,181 | py | Python | swaglyrics/tab.py | Tantan4321/SwagLyrics-For-Spotify | a94222992c469fa2754a6e060c0bc92ab4f230dd | [
"MIT"
] | 1 | 2021-04-21T17:13:41.000Z | 2021-04-21T17:13:41.000Z | swaglyrics/tab.py | Tantan4321/SwagLyrics-For-Spotify | a94222992c469fa2754a6e060c0bc92ab4f230dd | [
"MIT"
] | null | null | null | swaglyrics/tab.py | Tantan4321/SwagLyrics-For-Spotify | a94222992c469fa2754a6e060c0bc92ab4f230dd | [
"MIT"
] | null | null | null | import os
from swaglyrics.cli import lyrics
from swaglyrics import SameSongPlaying
from flask import Flask, render_template
from SwSpotify import spotify, SpotifyNotRunning
app = Flask(__name__, template_folder=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'))
# use relative path of the template f... | 28.119048 | 108 | 0.69348 | import os
from swaglyrics.cli import lyrics
from swaglyrics import SameSongPlaying
from flask import Flask, render_template
from SwSpotify import spotify, SpotifyNotRunning
app = Flask(__name__, template_folder=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'))
song = None
artist = None
@app.rou... | true | true |
f76ca414bca0dad78d6f3d124e4d077ecccbde0e | 4,960 | py | Python | tests/test_client.py | feeltheajf/h1-python | 4db7d8545a44541ae1c9b56c37f4e4dc0337d10b | [
"MIT"
] | 5 | 2019-05-30T16:39:30.000Z | 2020-01-02T14:42:02.000Z | tests/test_client.py | feeltheajf/h1-python | 4db7d8545a44541ae1c9b56c37f4e4dc0337d10b | [
"MIT"
] | null | null | null | tests/test_client.py | feeltheajf/h1-python | 4db7d8545a44541ae1c9b56c37f4e4dc0337d10b | [
"MIT"
] | 4 | 2019-05-16T08:18:48.000Z | 2020-04-01T12:52:52.000Z | # Copyright (c) 2016 Uber Technologies, Inc.
#
# 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, publ... | 41.680672 | 89 | 0.664718 |
from __future__ import print_function, unicode_literals, division, absolute_import
from collections import OrderedDict
import itertools
import json
import unittest
import requests_mock
from h1.client import encode_params, HackerOneClient
from h1.models import Report
from . import load_resource_blob
class TestPara... | true | true |
f76ca57aa355f1e1e5536a56ebd4119c814bf5e2 | 14,380 | py | Python | cms/admin/placeholderadmin.py | ScholzVolkmer/django-cms-old | 5641181e793ed3c833dd310fc3cc49c3660e548d | [
"BSD-3-Clause"
] | 1 | 2016-11-03T09:34:09.000Z | 2016-11-03T09:34:09.000Z | cms/admin/placeholderadmin.py | ScholzVolkmer/django-cms-old | 5641181e793ed3c833dd310fc3cc49c3660e548d | [
"BSD-3-Clause"
] | null | null | null | cms/admin/placeholderadmin.py | ScholzVolkmer/django-cms-old | 5641181e793ed3c833dd310fc3cc49c3660e548d | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from cms.forms.fields import PlaceholderFormField
from cms.models.fields import PlaceholderField
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_pool import plugin_pool
from cms.utils import get_language_from_request, cms_static_ur... | 44.9375 | 195 | 0.603964 | from cms.forms.fields import PlaceholderFormField
from cms.models.fields import PlaceholderField
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_pool import plugin_pool
from cms.utils import get_language_from_request, cms_static_url
from cms.utils.permiss... | true | true |
f76ca5838a97f7087e8c998038a9a31d88abbf2b | 5,363 | py | Python | gatk_pipelines/gatk_snake.py | danangcrysnanto/Graph-genotyping-paper-pipelines | f85e35019a47f2a40d83881fded3e2ab2dacf2bb | [
"MIT"
] | 5 | 2019-03-06T23:05:01.000Z | 2019-10-03T11:13:24.000Z | gatk_pipelines/gatk_snake.py | danangcrysnanto/Graph-genotyping-paper-pipelines | f85e35019a47f2a40d83881fded3e2ab2dacf2bb | [
"MIT"
] | 1 | 2022-03-28T09:51:34.000Z | 2022-03-28T09:51:34.000Z | gatk_pipelines/gatk_snake.py | danangcrysnanto/Graph-genotyping-paper-pipelines | f85e35019a47f2a40d83881fded3e2ab2dacf2bb | [
"MIT"
] | 4 | 2019-03-01T10:09:08.000Z | 2021-08-14T00:59:39.000Z | # Parsing the config files
configfile: "config.json"
# Parse the required files
BAMDIR = config["resources"]["bam"]
REF = config["resources"]["reference"]
# Parse path for tools
GATK = config["tools"]["GATK"]
BEAGLE = config["tools"]["BEAGLE"]
BCFTOOLS = config["tools"]["BCFTOOLS"]
LOAD_JAVA = config["tools"]["JAVA"]... | 27.22335 | 119 | 0.547455 | configfile: "config.json"
BAMDIR = config["resources"]["bam"]
REF = config["resources"]["reference"]
GATK = config["tools"]["GATK"]
BEAGLE = config["tools"]["BEAGLE"]
BCFTOOLS = config["tools"]["BCFTOOLS"]
LOAD_JAVA = config["tools"]["JAVA"]
OUTDIR = config["base_out"]["out_dir"]
chr_list = list(range(1, 30))
ch_i... | false | true |
f76ca623c3b68255bdc5024b0621c7776b45b846 | 184,640 | py | Python | tensorflow_estimator/python/estimator/tpu/tpu_estimator.py | qasimtariq1171/estimator | e7fcffa942006fc2ecf4905523df2d8d6fcf51bd | [
"Apache-2.0"
] | 1 | 2021-05-10T10:53:28.000Z | 2021-05-10T10:53:28.000Z | tensorflow_estimator/python/estimator/tpu/tpu_estimator.py | qasimtariq1171/estimator | e7fcffa942006fc2ecf4905523df2d8d6fcf51bd | [
"Apache-2.0"
] | null | null | null | tensorflow_estimator/python/estimator/tpu/tpu_estimator.py | qasimtariq1171/estimator | e7fcffa942006fc2ecf4905523df2d8d6fcf51bd | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.732407 | 147 | 0.687083 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import enum
import math
import os
import signal
import sys
import threading
import time
import tensorflow as tf
import numpy as np
import six
from six.moves import queue as Queu... | true | true |
f76ca6b77840703630effa1940e303a2b944d5cb | 6,165 | py | Python | matlab_examiner.py | jfitz/code-stat | dd2a13177f3ef03ab42123ef3cfcbbd062a2ae26 | [
"MIT"
] | null | null | null | matlab_examiner.py | jfitz/code-stat | dd2a13177f3ef03ab42123ef3cfcbbd062a2ae26 | [
"MIT"
] | null | null | null | matlab_examiner.py | jfitz/code-stat | dd2a13177f3ef03ab42123ef3cfcbbd062a2ae26 | [
"MIT"
] | null | null | null | import string
import math
from codestat_token import Token
from codestat_tokenizer import Tokenizer
from token_builders import (
InvalidTokenBuilder,
WhitespaceTokenBuilder,
NewlineTokenBuilder,
IntegerTokenBuilder,
IntegerExponentTokenBuilder,
PrefixedIntegerTokenBuilder,
RealTokenBuilder,
RealExponen... | 28.541667 | 89 | 0.673966 | import string
import math
from codestat_token import Token
from codestat_tokenizer import Tokenizer
from token_builders import (
InvalidTokenBuilder,
WhitespaceTokenBuilder,
NewlineTokenBuilder,
IntegerTokenBuilder,
IntegerExponentTokenBuilder,
PrefixedIntegerTokenBuilder,
RealTokenBuilder,
RealExponen... | true | true |
f76ca709efa511ceeb4246e825597cb70a59ad0a | 13,908 | py | Python | autotest/gdrivers/vrtmask.py | tbonfort/gdal | 173e0659bc3f2e6b97c2c07332a3066478afb821 | [
"MIT"
] | 1 | 2015-04-21T19:52:03.000Z | 2015-04-21T19:52:03.000Z | autotest/gdrivers/vrtmask.py | tbonfort/gdal | 173e0659bc3f2e6b97c2c07332a3066478afb821 | [
"MIT"
] | 1 | 2016-04-04T09:14:19.000Z | 2016-04-14T19:17:10.000Z | autotest/gdrivers/vrtmask.py | pramsey/gdal | 965421b79fe4d3332b0f2f633b072fdcab2b700a | [
"MIT"
] | 2 | 2018-05-08T01:51:34.000Z | 2019-06-26T05:08:56.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test mask bands in VRT driver
# Author: Even Rouault <even dot rouault at mines dash paris dot org>
#
#####################################... | 32.879433 | 159 | 0.604544 |
import os
import sys
from osgeo import gdal
sys.path.append( '../pymod' )
import gdaltest
def vrtmask_1():
vrt_string = """<VRTDataset rasterXSize="20" rasterYSize="20">
<VRTRasterBand dataType="Byte" band="1">
<ColorInterp>Gray</ColorInterp>
<SimpleSource>
<SourceFilename relativeToVRT="0">da... | true | true |
f76ca871f68d082744ba490e505e896293868c8d | 6,527 | py | Python | Editted Code/WAN/lorawan_gateway.py | Michaelgal13/EE456 | 3af7fe6d9443dae740c20156f94536f0747b6200 | [
"MIT"
] | 1 | 2020-10-21T07:51:07.000Z | 2020-10-21T07:51:07.000Z | Editted Code/WAN/lorawan_gateway.py | Michaelgal13/EE456 | 3af7fe6d9443dae740c20156f94536f0747b6200 | [
"MIT"
] | null | null | null | Editted Code/WAN/lorawan_gateway.py | Michaelgal13/EE456 | 3af7fe6d9443dae740c20156f94536f0747b6200 | [
"MIT"
] | null | null | null | """
Raspberry Pi Single Channel Gateway
Learn Guide: https://learn.adafruit.com/raspberry-pi-single-channel-lorawan-gateway
Author: Brent Rubell for Adafruit Industries
"""
# Import Python System Libraries
import json
import time
import subprocess
import uuid
# Import Adafruit Blinka Libraries
import busio
from digita... | 34.352632 | 109 | 0.598897 | import json
import time
import subprocess
import uuid
import busio
from digitalio import DigitalInOut, Direction, Pull
import board
import adafruit_ssd1306
btnA = DigitalInOut(board.D13)
btnA.direction = Direction.INPUT
btnA.pull = Pull.UP
btnB = DigitalInOut(board.D6)
btnB.direction = Direction.INPUT
btnB.pull = Pul... | true | true |
f76ca8a1044191ce1473898b133a58061c65894e | 626 | py | Python | bika/lims/upgrade/to3005.py | hocinebendou/bika.gsoc | 85bc0c587de7f52073ae0e89bddbc77bf875f295 | [
"MIT"
] | null | null | null | bika/lims/upgrade/to3005.py | hocinebendou/bika.gsoc | 85bc0c587de7f52073ae0e89bddbc77bf875f295 | [
"MIT"
] | null | null | null | bika/lims/upgrade/to3005.py | hocinebendou/bika.gsoc | 85bc0c587de7f52073ae0e89bddbc77bf875f295 | [
"MIT"
] | null | null | null | from Acquisition import aq_inner
from Acquisition import aq_parent
from bika.lims.permissions import *
def upgrade(tool):
"""Added D3.js library and D3 Control-chart for Instrument QC
"""
# Hack prevent out-of-date upgrading
# Related: PR #1484
# https://github.com/bikalabs/Bika-LIMS/pull/1484
... | 27.217391 | 77 | 0.71885 | from Acquisition import aq_inner
from Acquisition import aq_parent
from bika.lims.permissions import *
def upgrade(tool):
from bika.lims.upgrade import skip_pre315
if skip_pre315(aq_parent(aq_inner(tool))):
return True
portal = aq_parent(aq_inner(tool))
setup = portal.portal_setup... | true | true |
f76ca8b4240daedc93a44d8964ccfe21185b2dd1 | 4,044 | py | Python | scripts/artifacts/chromeLoginData.py | deagler4n6/ALEAPP | c25692dac34e2382d1a8d51e5fbb2a39998dc638 | [
"MIT"
] | null | null | null | scripts/artifacts/chromeLoginData.py | deagler4n6/ALEAPP | c25692dac34e2382d1a8d51e5fbb2a39998dc638 | [
"MIT"
] | null | null | null | scripts/artifacts/chromeLoginData.py | deagler4n6/ALEAPP | c25692dac34e2382d1a8d51e5fbb2a39998dc638 | [
"MIT"
] | null | null | null | import datetime
import os
import re
import sqlite3
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import PBKDF2
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, get_next_unused_name, open_sqlite_db_readonly
def decrypt(ciphertxt,... | 38.884615 | 120 | 0.620178 | import datetime
import os
import re
import sqlite3
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import PBKDF2
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, get_next_unused_name, open_sqlite_db_readonly
def decrypt(ciphertxt,... | true | true |
f76ca8c8572a43cf687f1694f511dad83cdae688 | 6,792 | py | Python | pluto_gen_stats.py | eliemichel/ReACORN | 74501551ecb387352271674efb2ed6240d234df6 | [
"MIT"
] | 1 | 2021-07-09T19:26:33.000Z | 2021-07-09T19:26:33.000Z | pluto_gen_stats.py | eliemichel/ReACORN | 74501551ecb387352271674efb2ed6240d234df6 | [
"MIT"
] | null | null | null | pluto_gen_stats.py | eliemichel/ReACORN | 74501551ecb387352271674efb2ed6240d234df6 | [
"MIT"
] | null | null | null | # This file is part of ReACORN, a reimplementation by Élie Michel of the ACORN
# paper by Martel et al. published at SIGGRAPH 2021.
#
# Copyright (c) 2021 -- Télécom Paris (Élie Michel <elie.michel@telecom-paris.fr>)
#
# The MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# ... | 36.320856 | 92 | 0.668139 |
import torch
import os
from argparse import Namespace
from matplotlib.image import imread, imsave
from matplotlib import pyplot as plt
import numpy as np
import acorn_eval_image
target_image_filname = "data/pluto.png"
checkpoint_dir = "checkpoints/pluto"
output_dir = "outputs/pluto"
device = "cuda"
quadtree_output... | true | true |
f76ca93e09bd986913a486fcbedd7aa15676ca1a | 4,828 | py | Python | pypureclient/pure1/Pure1_1_1/models/metric.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 14 | 2018-12-07T18:30:27.000Z | 2022-02-22T09:12:33.000Z | pypureclient/pure1/Pure1_1_1/models/metric.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 28 | 2019-09-17T21:03:52.000Z | 2022-03-29T22:07:35.000Z | pypureclient/pure1/Pure1_1_1/models/metric.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 15 | 2020-06-11T15:50:08.000Z | 2022-03-21T09:27:25.000Z | # coding: utf-8
"""
Pure1 Public REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from... | 32.621622 | 253 | 0.559445 |
import pprint
import re
import six
import typing
from ....properties import Property
if typing.TYPE_CHECKING:
from pypureclient.pure1.Pure1_1_1 import models
class Metric(object):
swagger_types = {
'as_of': 'int',
'id': 'str',
'name': 'str',
'availabilities': 'list[MetricAv... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.