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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3508df5c374c4813d7bd926e4b8697e3ef238f | 998 | py | Python | layers/shortcuts.py | ultraglorious/cyclegan-learning | ed141e155d60cdfb1e2c14bdf64fc96fee0b5200 | [
"MIT"
] | null | null | null | layers/shortcuts.py | ultraglorious/cyclegan-learning | ed141e155d60cdfb1e2c14bdf64fc96fee0b5200 | [
"MIT"
] | null | null | null | layers/shortcuts.py | ultraglorious/cyclegan-learning | ed141e155d60cdfb1e2c14bdf64fc96fee0b5200 | [
"MIT"
] | null | null | null | import layers
def c7s1k(k: int, activation: str = "relu") -> layers.ConvolutionBlock:
"""Shortcut function to c7s1-k layer."""
return layers.ConvolutionBlock(7, 1, k, activation=activation)
def dk(k: int) -> layers.ConvolutionBlock:
"""Shortcut to dk layer. Reflection padding seems to have only been do... | 36.962963 | 107 | 0.713427 | import layers
def c7s1k(k: int, activation: str = "relu") -> layers.ConvolutionBlock:
return layers.ConvolutionBlock(7, 1, k, activation=activation)
def dk(k: int) -> layers.ConvolutionBlock:
return layers.ConvolutionBlock(3, 2, k, reflect_padding=True)
def uk(k: int) -> layers.ConvolutionBlock:
retur... | true | true |
1c350afe4ddd366b54a79a06bb6777bfe5eab20f | 4,532 | py | Python | dalle_pytorch/vae.py | haskie-lambda/DALLE-pytorch | 3c59dc9864cc900cefd656f73772e151af4fb97f | [
"MIT"
] | 2 | 2021-06-24T19:36:02.000Z | 2021-06-24T20:32:32.000Z | dalle_pytorch/vae.py | haskie-lambda/DALLE-pytorch | 3c59dc9864cc900cefd656f73772e151af4fb97f | [
"MIT"
] | null | null | null | dalle_pytorch/vae.py | haskie-lambda/DALLE-pytorch | 3c59dc9864cc900cefd656f73772e151af4fb97f | [
"MIT"
] | null | null | null | import io
import sys
import os, sys
import requests
import PIL
import warnings
import os
import hashlib
import urllib
import yaml
from pathlib import Path
from tqdm import tqdm
from math import sqrt
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
import torch
from torch import nn
import torch.n... | 29.23871 | 102 | 0.647176 | import io
import sys
import os, sys
import requests
import PIL
import warnings
import os
import hashlib
import urllib
import yaml
from pathlib import Path
from tqdm import tqdm
from math import sqrt
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
import torch
from torch import nn
import torch.n... | true | true |
1c350b4b10fd65ce70ca77ba9f9e4419bd36a485 | 1,215 | py | Python | app/users/models.py | onosendi/flask-boilerplate | 4e4734e2ac416c5ef6a82b2b36b2458de0463091 | [
"Unlicense"
] | 5 | 2020-05-25T02:06:50.000Z | 2021-05-03T22:37:12.000Z | app/users/models.py | onosendi/flask-boilerplate | 4e4734e2ac416c5ef6a82b2b36b2458de0463091 | [
"Unlicense"
] | null | null | null | app/users/models.py | onosendi/flask-boilerplate | 4e4734e2ac416c5ef6a82b2b36b2458de0463091 | [
"Unlicense"
] | 2 | 2020-07-18T13:01:29.000Z | 2020-11-26T16:43:56.000Z | from flask_login import UserMixin
from werkzeug.security import check_password_hash, generate_password_hash
from app.common.extensions import db, login
from app.common.models import BaseMixin, SoftDeleteMixin, TimestampMixin
class User(
UserMixin,
BaseMixin,
SoftDeleteMixin,
TimestampMixin,
db.Mo... | 31.153846 | 73 | 0.683951 | from flask_login import UserMixin
from werkzeug.security import check_password_hash, generate_password_hash
from app.common.extensions import db, login
from app.common.models import BaseMixin, SoftDeleteMixin, TimestampMixin
class User(
UserMixin,
BaseMixin,
SoftDeleteMixin,
TimestampMixin,
db.Mo... | true | true |
1c350bc3b76d57a7c99c9fd181d2b1de2a842cb7 | 5,185 | py | Python | groupdocs_signature_cloud/models/time_stamp.py | groupdocs-signature-cloud/groupdocs-signature-cloud-python | 2b7f03b3d70f191dc1292f6221ed9301811681cf | [
"MIT"
] | null | null | null | groupdocs_signature_cloud/models/time_stamp.py | groupdocs-signature-cloud/groupdocs-signature-cloud-python | 2b7f03b3d70f191dc1292f6221ed9301811681cf | [
"MIT"
] | null | null | null | groupdocs_signature_cloud/models/time_stamp.py | groupdocs-signature-cloud/groupdocs-signature-cloud-python | 2b7f03b3d70f191dc1292f6221ed9301811681cf | [
"MIT"
] | 1 | 2021-02-03T00:18:17.000Z | 2021-02-03T00:18:17.000Z | # coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose Pty Ltd" file="TimeStamp.py">
# Copyright (c) 2003-2021 Aspose Pty Ltd
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of t... | 28.027027 | 85 | 0.543105 |
import pprint
import re
import six
class TimeStamp(object):
swagger_types = {
'url': 'str',
'user': 'str',
'password': 'str'
}
attribute_map = {
'url': 'Url',
'user': 'User',
'password': 'Password'
}
def __init__(self,... | true | true |
1c350cff265b3d8016a43c446d64999c2d32b3e3 | 6,479 | py | Python | tests/test_packages/test_skills/test_generic_seller/test_dialogues.py | valory-xyz/agents-aea | 8f38efa96041b0156ed1ae328178e395dbabf2fc | [
"Apache-2.0"
] | 28 | 2021-10-31T18:54:14.000Z | 2022-03-17T13:10:43.000Z | tests/test_packages/test_skills/test_generic_seller/test_dialogues.py | valory-xyz/agents-aea | 8f38efa96041b0156ed1ae328178e395dbabf2fc | [
"Apache-2.0"
] | 66 | 2021-10-31T11:55:48.000Z | 2022-03-31T06:26:23.000Z | tests/test_packages/test_skills/test_generic_seller/test_dialogues.py | valory-xyz/agents-aea | 8f38efa96041b0156ed1ae328178e395dbabf2fc | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | 38.337278 | 89 | 0.656428 |
from pathlib import Path
from typing import cast
import pytest
from aea.exceptions import AEAEnforceError
from aea.helpers.transaction.base import Terms
from aea.protocols.dialogue.base import DialogueLabel
from aea.test_tools.test_skill import BaseSkillTestCase, COUNTERPARTY_AGENT_ADDRESS
from p... | true | true |
1c350d442c7d186deb105cfcbcba108ae69e92e0 | 2,660 | py | Python | Turla Group/Kopiluwak/kopiluwakUAShodanSearch.py | CharityW4CTI/Research | 75ef5dada737148bc105b2b0cc2f276cf35266d7 | [
"MIT"
] | null | null | null | Turla Group/Kopiluwak/kopiluwakUAShodanSearch.py | CharityW4CTI/Research | 75ef5dada737148bc105b2b0cc2f276cf35266d7 | [
"MIT"
] | null | null | null | Turla Group/Kopiluwak/kopiluwakUAShodanSearch.py | CharityW4CTI/Research | 75ef5dada737148bc105b2b0cc2f276cf35266d7 | [
"MIT"
] | null | null | null | import shodan
import re
import argparse
import textwrap
def kopiluwak_match(ua):
found = False
# get only the last 32 characters of the UA
ua_stripped = ua[-32:]
# see if the last 32 characters of the array match the Kopiluwak regex
matchObj = re.search("([0-9]{16}[a-zA-Z0-9]{16})", ua_stripped)
... | 29.88764 | 125 | 0.579323 | import shodan
import re
import argparse
import textwrap
def kopiluwak_match(ua):
found = False
ua_stripped = ua[-32:]
matchObj = re.search("([0-9]{16}[a-zA-Z0-9]{16})", ua_stripped)
if matchObj:
found = True
return found
def uaShodanCheck(ua, SHODAN_API_KEY):
api = shodan.S... | true | true |
1c350edcd8d3589e728d7f3781f5b74c4ada5167 | 82,249 | py | Python | PythonVirtEnv/Lib/site-packages/plotly/graph_objs/_pie.py | zuhorski/EPL_Project | 2d2417652879cfbe33c44c003ad77b7222590849 | [
"MIT"
] | 2 | 2021-07-18T11:39:56.000Z | 2021-11-06T17:13:05.000Z | venv/Lib/site-packages/plotly/graph_objs/_pie.py | wakisalvador/constructed-misdirection | 74779e9ec640a11bc08d5d1967c85ac4fa44ea5e | [
"Unlicense"
] | null | null | null | venv/Lib/site-packages/plotly/graph_objs/_pie.py | wakisalvador/constructed-misdirection | 74779e9ec640a11bc08d5d1967c85ac4fa44ea5e | [
"Unlicense"
] | null | null | null | from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Pie(_BaseTraceType):
# class properties
# --------------------
_parent_path_str = ""
_path_str = "pie"
_valid_props = {
"automargin",
"customdata",
"customdatasrc",
"directi... | 34.500419 | 103 | 0.560566 | from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Pie(_BaseTraceType):
_parent_path_str = ""
_path_str = "pie"
_valid_props = {
"automargin",
"customdata",
"customdatasrc",
"direction",
"dlabel",
"domain",... | true | true |
1c351047d4d3a9a39b90f064887092fa28a80ef7 | 68,641 | py | Python | python/ccxt/kucoinfutures.py | mattepozz/ccxt | f60278e707af6f6baa55ee027a907bd72d852201 | [
"MIT"
] | null | null | null | python/ccxt/kucoinfutures.py | mattepozz/ccxt | f60278e707af6f6baa55ee027a907bd72d852201 | [
"MIT"
] | null | null | null | python/ccxt/kucoinfutures.py | mattepozz/ccxt | f60278e707af6f6baa55ee027a907bd72d852201 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.kucoin import kucoin
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import PermissionDenied
from ccxt.bas... | 45.010492 | 352 | 0.478271 |
rt kucoin
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import PermissionDenied
from ccxt.base.errors import AccountSuspended
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors import BadRequest
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import Inv... | true | true |
1c3511fecc84eb80bd643980e0e9ad5b84b0f0ed | 5,265 | py | Python | synaptic_fitting/Heatmap_3000-4000.py | danielmk/pyDentate | df8f67d4523ce463701c5e5675e74e309dd151e7 | [
"MIT"
] | 1 | 2022-02-24T20:39:46.000Z | 2022-02-24T20:39:46.000Z | synaptic_fitting/Heatmap_3000-4000.py | danielmk/pydentate | df8f67d4523ce463701c5e5675e74e309dd151e7 | [
"MIT"
] | null | null | null | synaptic_fitting/Heatmap_3000-4000.py | danielmk/pydentate | df8f67d4523ce463701c5e5675e74e309dd151e7 | [
"MIT"
] | 4 | 2021-11-02T07:47:42.000Z | 2021-11-30T09:07:35.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 15:36:56 2019
@author: barisckuru
"""
import numpy as np
import os
from tmgexp2_simulator import simulate
import matplotlib.pyplot as plt
import time
import seaborn as sns
import pandas as pd
import pickle
begin = time.time()
# PARAMETERS
fre... | 25.935961 | 80 | 0.640646 |
import numpy as np
import os
from tmgexp2_simulator import simulate
import matplotlib.pyplot as plt
import time
import seaborn as sns
import pandas as pd
import pickle
begin = time.time()
freq_1 = []
freq_10 = []
freq_30 = []
freq_50 = []
load_1 = []
peaks = []
taus = []
norm = []
data_path = "/home/can/Downlo... | true | true |
1c35124937409aabe6eca6f0ec63180114a253b1 | 1,431 | py | Python | kiss_cache/stores/django_cache.py | HiveTraum/KISSCache-Python | c6f601b3c510e0dd6f4340ea6c013267d8424643 | [
"MIT"
] | null | null | null | kiss_cache/stores/django_cache.py | HiveTraum/KISSCache-Python | c6f601b3c510e0dd6f4340ea6c013267d8424643 | [
"MIT"
] | null | null | null | kiss_cache/stores/django_cache.py | HiveTraum/KISSCache-Python | c6f601b3c510e0dd6f4340ea6c013267d8424643 | [
"MIT"
] | 1 | 2019-12-03T05:54:31.000Z | 2019-12-03T05:54:31.000Z | import logging
from typing import Callable, Any
from uuid import uuid4
logger = logging.getLogger(__name__)
def default_serialize(value: Any) -> str:
return value
def default_deserialize(value: str) -> Any:
return value
class DjangoCacheStore:
def __init__(self, cache_identifier='default',
... | 24.672414 | 74 | 0.60587 | import logging
from typing import Callable, Any
from uuid import uuid4
logger = logging.getLogger(__name__)
def default_serialize(value: Any) -> str:
return value
def default_deserialize(value: str) -> Any:
return value
class DjangoCacheStore:
def __init__(self, cache_identifier='default',
... | true | true |
1c35134960a8258bd7bd63f12ed1b98722ad5d7b | 1,130 | py | Python | cascad/agents/aritifcial_system/contracts/pm/MarketMaker.py | Will-Holden/cascadv2 | fd43d47d4be075d30e75053f9af3cd82c33b6623 | [
"Apache-2.0"
] | null | null | null | cascad/agents/aritifcial_system/contracts/pm/MarketMaker.py | Will-Holden/cascadv2 | fd43d47d4be075d30e75053f9af3cd82c33b6623 | [
"Apache-2.0"
] | null | null | null | cascad/agents/aritifcial_system/contracts/pm/MarketMaker.py | Will-Holden/cascadv2 | fd43d47d4be075d30e75053f9af3cd82c33b6623 | [
"Apache-2.0"
] | 1 | 2022-03-24T10:01:28.000Z | 2022-03-24T10:01:28.000Z | from cascad.agents.aritifcial_system.contracts.token.ERC20 import ERC20
class MarketMaker:
def __init__(self, pmSystem, collateralToken: ERC20, conditionIds, atomicOutcomeSlotCount, fee, funding, stage, whitelist, outcomeSlotCounts, collectionIds, positionIds, owner=None):
self.pmSystem = pmSystem
... | 29.736842 | 186 | 0.669027 | from cascad.agents.aritifcial_system.contracts.token.ERC20 import ERC20
class MarketMaker:
def __init__(self, pmSystem, collateralToken: ERC20, conditionIds, atomicOutcomeSlotCount, fee, funding, stage, whitelist, outcomeSlotCounts, collectionIds, positionIds, owner=None):
self.pmSystem = pmSystem
... | true | true |
1c351511f358442a292e6f21da74651a5abef80f | 9,844 | py | Python | src/schnetpack/representation/schnet.py | giadefa/schnetpack | 9dabc3b6e3b28deb2fb3743ea1857c46b055efbf | [
"MIT"
] | 2 | 2020-12-29T05:28:20.000Z | 2020-12-29T05:30:13.000Z | src/schnetpack/representation/schnet.py | giadefa/schnetpack | 9dabc3b6e3b28deb2fb3743ea1857c46b055efbf | [
"MIT"
] | null | null | null | src/schnetpack/representation/schnet.py | giadefa/schnetpack | 9dabc3b6e3b28deb2fb3743ea1857c46b055efbf | [
"MIT"
] | 1 | 2021-01-22T13:44:31.000Z | 2021-01-22T13:44:31.000Z | import torch
import torch.nn as nn
from schnetpack.nn.base import Dense
from schnetpack import Properties
from schnetpack.nn.cfconv import CFConv
from schnetpack.nn.cutoff import CosineCutoff
from schnetpack.nn.acsf import GaussianSmearing
from schnetpack.nn.neighbors import AtomDistances
from schnetpack.nn.activation... | 40.677686 | 90 | 0.636022 | import torch
import torch.nn as nn
from schnetpack.nn.base import Dense
from schnetpack import Properties
from schnetpack.nn.cfconv import CFConv
from schnetpack.nn.cutoff import CosineCutoff
from schnetpack.nn.acsf import GaussianSmearing
from schnetpack.nn.neighbors import AtomDistances
from schnetpack.nn.activation... | true | true |
1c35157c9fe7539f712f26bd3ec3763008713658 | 2,202 | py | Python | peer/models/person.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | peer/models/person.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | peer/models/person.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ---------------------------------------------------------------------
# Person models
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Third-party modul... | 32.865672 | 83 | 0.556767 |
from django.db import models
from noc.core.model.base import NOCModel
from noc.core.gridvcs.manager import GridVCSField
from noc.core.rpsl import rpsl_format, rpsl_multiple
from noc.core.model.decorator import on_save
from .rir import RIR
@on_save
class Person(NOCModel):
class Meta(object):
verb... | true | true |
1c351733324a5dc157de87d80d6cc8aecc3b785f | 13,804 | py | Python | src/main.py | kppw99/UG_FedAVG | 61f6fcfedfed1136b19c12a6603231cda884e22f | [
"MIT"
] | 3 | 2021-09-23T02:10:17.000Z | 2022-01-16T03:38:34.000Z | src/main.py | kppw99/Uncert_FedAVG | 61f6fcfedfed1136b19c12a6603231cda884e22f | [
"MIT"
] | 1 | 2022-02-25T08:03:34.000Z | 2022-02-25T08:03:34.000Z | src/main.py | kppw99/Uncert_FedAVG | 61f6fcfedfed1136b19c12a6603231cda884e22f | [
"MIT"
] | 1 | 2022-02-23T11:49:25.000Z | 2022-02-23T11:49:25.000Z | from util import *
from model import *
if __name__=='__main__':
# Parse arguments
DATASET, MODEL_LIST, IID_NON_COR, NON_IID_NON_COR = arg_parse()
if DATASET == 'mnist':
from mnist_config import *
elif DATASET == 'fmnist':
from fmnist_config import *
elif DATASET == 'cifar10':
... | 58.740426 | 121 | 0.407925 | from util import *
from model import *
if __name__=='__main__':
DATASET, MODEL_LIST, IID_NON_COR, NON_IID_NON_COR = arg_parse()
if DATASET == 'mnist':
from mnist_config import *
elif DATASET == 'fmnist':
from fmnist_config import *
elif DATASET == 'cifar10':
from cifar10_... | true | true |
1c3517ba62458442d409f0861659c1c996a2b301 | 4,814 | py | Python | setup.py | minddistrict/zope.index | 7fd8bbad0584e21c0158e73681bcf99b6bacb699 | [
"ZPL-2.1"
] | null | null | null | setup.py | minddistrict/zope.index | 7fd8bbad0584e21c0158e73681bcf99b6bacb699 | [
"ZPL-2.1"
] | null | null | null | setup.py | minddistrict/zope.index | 7fd8bbad0584e21c0158e73681bcf99b6bacb699 | [
"ZPL-2.1"
] | 1 | 2021-09-29T19:54:14.000Z | 2021-09-29T19:54:14.000Z | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | 36.195489 | 78 | 0.613004 | true | true | |
1c35183f1cdcc7b0458bca42b837355b152e5542 | 443 | py | Python | libs/model/Num3.py | zyfccc/Spectral-Illumination-Correction-Achieving-Relative-Color-Constancy-Under-the-Spectral-Domain | 051af9662dbe53deaf2d493fe8dbf0c9adce7ccb | [
"MIT"
] | 8 | 2019-12-17T15:07:17.000Z | 2021-08-19T09:13:58.000Z | libs/model/Num3.py | zyfccc/Spectral-Illumination-Correction-Achieving-Relative-Color-Constancy-Under-the-Spectral-Domain | 051af9662dbe53deaf2d493fe8dbf0c9adce7ccb | [
"MIT"
] | null | null | null | libs/model/Num3.py | zyfccc/Spectral-Illumination-Correction-Achieving-Relative-Color-Constancy-Under-the-Spectral-Domain | 051af9662dbe53deaf2d493fe8dbf0c9adce7ccb | [
"MIT"
] | 3 | 2020-01-06T04:20:55.000Z | 2020-01-25T08:42:30.000Z |
class Num3:
def __init__(self, x=0, y=0, z=0, json=None):
if json is not None:
self.fromJson(json)
else:
self.x = x
self.y = y
self.z = z
def toJson(self):
return {
'x': self.x,
'y': self.y,
'z': self.z... | 20.136364 | 49 | 0.399549 |
class Num3:
def __init__(self, x=0, y=0, z=0, json=None):
if json is not None:
self.fromJson(json)
else:
self.x = x
self.y = y
self.z = z
def toJson(self):
return {
'x': self.x,
'y': self.y,
'z': self.z... | true | true |
1c3518a52d1603a28901baeebc4e463bea27365a | 407 | py | Python | IncludeVisitor.py | ArmindoFlores/MineScript | 347d7dd61ac1e39e4707210ede98e9c3ca44c891 | [
"MIT"
] | 5 | 2019-07-31T19:20:07.000Z | 2022-02-16T09:48:06.000Z | IncludeVisitor.py | ArmindoFlores/MineScript | 347d7dd61ac1e39e4707210ede98e9c3ca44c891 | [
"MIT"
] | null | null | null | IncludeVisitor.py | ArmindoFlores/MineScript | 347d7dd61ac1e39e4707210ede98e9c3ca44c891 | [
"MIT"
] | null | null | null | from MineScriptVisitor import MineScriptVisitor
class IncludeVisitor(MineScriptVisitor):
def __init__(self):
self.modules = []
def add_module(self, module, line):
if module not in self.modules:
self.modules.append((module, line))
def visitInclude(self, ctx):
... | 25.4375 | 48 | 0.619165 | from MineScriptVisitor import MineScriptVisitor
class IncludeVisitor(MineScriptVisitor):
def __init__(self):
self.modules = []
def add_module(self, module, line):
if module not in self.modules:
self.modules.append((module, line))
def visitInclude(self, ctx):
... | true | true |
1c3518d2f2a5ab734aa304864fde549bb568a3b1 | 1,262 | gyp | Python | binding.gyp | ismailrei/devisPattern | b20dd604dcfa609fec4dd1d4a14129f604b5870e | [
"MIT"
] | 1 | 2017-11-06T08:23:54.000Z | 2017-11-06T08:23:54.000Z | binding.gyp | ismailrei/devisPattern | b20dd604dcfa609fec4dd1d4a14129f604b5870e | [
"MIT"
] | null | null | null | binding.gyp | ismailrei/devisPattern | b20dd604dcfa609fec4dd1d4a14129f604b5870e | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "addon",
"sources": [
"addon.cpp",
"devisPattern.cpp"
],
"cflags" : [ "-std=c++11"],
"cflags!": [ '-fno-exceptions' ],
... | 42.066667 | 108 | 0.211569 | {
"targets": [
{
"target_name": "addon",
"sources": [
"addon.cpp",
"devisPattern.cpp"
],
"cflags" : [ "-std=c++11"],
"cflags!": [ '-fno-exceptions' ],
... | true | true |
1c3519e8931da5c128759a4b15790e3e7153cd00 | 11,342 | py | Python | src/microprobe/utils/objdump.py | TheArni/microprobe | 46d17a9744b943bb448fc5e2872f3521084d8bec | [
"Apache-2.0"
] | 13 | 2018-09-06T05:16:08.000Z | 2022-03-07T23:03:46.000Z | src/microprobe/utils/objdump.py | TheArni/microprobe | 46d17a9744b943bb448fc5e2872f3521084d8bec | [
"Apache-2.0"
] | 24 | 2018-07-10T01:56:10.000Z | 2022-02-22T22:38:25.000Z | src/microprobe/utils/objdump.py | TheArni/microprobe | 46d17a9744b943bb448fc5e2872f3521084d8bec | [
"Apache-2.0"
] | 12 | 2018-09-06T13:58:24.000Z | 2022-01-27T21:15:39.000Z | # Copyright 2011-2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 28.21393 | 79 | 0.615059 |
from __future__ import absolute_import, print_function
import re
from six.moves import zip
from microprobe import MICROPROBE_RC
from microprobe.code.address import Address
from microprobe.code.ins import MicroprobeInstructionDefinition
from microprobe.exceptions import MicroprobeAsmError, \
Mic... | true | true |
1c3519f6988a89d9216812d575f2b01c4a4a00ec | 3,246 | py | Python | sigmaproject/computer_vision/convolution.py | k-zen/SigmaProject | b844766d28d142ed1fb4d2e20f4e9dbad0ad90a6 | [
"BSD-2-Clause"
] | null | null | null | sigmaproject/computer_vision/convolution.py | k-zen/SigmaProject | b844766d28d142ed1fb4d2e20f4e9dbad0ad90a6 | [
"BSD-2-Clause"
] | 8 | 2020-04-27T19:31:23.000Z | 2021-08-06T19:43:46.000Z | sigmaproject/computer_vision/convolution.py | k-zen/SigmaProject | b844766d28d142ed1fb4d2e20f4e9dbad0ad90a6 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Copyright (c) 2019, Andreas Koenzen <akoenzen | uvic.ca>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright not... | 32.46 | 108 | 0.603204 |
import numpy as np
from .utilities import Utilities
from typing import Dict
class Convolution(object):
IDENTITY = 1
EDGES_1 = 2
EDGES_2 = 3
EDGES_3 = 4
KERNELS: Dict[int, np.array] = {
IDENTITY: np.array([
[+0, +0, +0],
[+0, +1, +0],
[+0, +0, +0]
... | true | true |
1c351ba2cb26f12b8aa12dea1aabed6bfb5db532 | 790 | py | Python | allennlp/data/tokenizers/whitespace_tokenizer.py | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 | [
"Apache-2.0"
] | 2 | 2021-04-27T19:56:28.000Z | 2021-08-19T05:34:37.000Z | allennlp/data/tokenizers/whitespace_tokenizer.py | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 | [
"Apache-2.0"
] | 5 | 2021-05-03T14:40:33.000Z | 2021-05-03T14:40:34.000Z | allennlp/data/tokenizers/whitespace_tokenizer.py | justindujardin/allennlp | c4559f3751775aa8bc018db417edc119d29d8051 | [
"Apache-2.0"
] | 2 | 2019-12-21T05:58:44.000Z | 2021-08-16T07:41:21.000Z | from typing import List
from overrides import overrides
from allennlp.data.tokenizers.token import Token
from allennlp.data.tokenizers.tokenizer import Tokenizer
@Tokenizer.register("whitespace")
@Tokenizer.register("just_spaces")
class WhitespaceTokenizer(Tokenizer):
"""
A `Tokenizer` that assumes you've a... | 32.916667 | 96 | 0.743038 | from typing import List
from overrides import overrides
from allennlp.data.tokenizers.token import Token
from allennlp.data.tokenizers.tokenizer import Tokenizer
@Tokenizer.register("whitespace")
@Tokenizer.register("just_spaces")
class WhitespaceTokenizer(Tokenizer):
@overrides
def tokenize(self, text: st... | true | true |
1c351c3f2dec267423582ad0944d047edfbf41a2 | 2,937 | py | Python | driftconfig/schemautil.py | kristjanvalur/drift-config | 80cb57b19b11d351b93c041bf403e89ed535dbf2 | [
"MIT"
] | null | null | null | driftconfig/schemautil.py | kristjanvalur/drift-config | 80cb57b19b11d351b93c041bf403e89ed535dbf2 | [
"MIT"
] | null | null | null | driftconfig/schemautil.py | kristjanvalur/drift-config | 80cb57b19b11d351b93c041bf403e89ed535dbf2 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Schema Util - Helpers to pretty print Json schema errors and other bits.
'''
import logging
import jsonschema
from json import dumps
from StringIO import StringIO
log = logging.getLogger(__name__)
def check_schema(json_object, schema, title=None):
"""Do json schema ... | 32.274725 | 92 | 0.608444 |
'''
Schema Util - Helpers to pretty print Json schema errors and other bits.
'''
import logging
import jsonschema
from json import dumps
from StringIO import StringIO
log = logging.getLogger(__name__)
def check_schema(json_object, schema, title=None):
"""Do json schema check on object and abor... | false | true |
1c351c9423d609c42c4be79fbf5316d3b85b0cc5 | 17,886 | py | Python | corehq/apps/accounting/migrations/0010_auto__chg_field_billingaccount_name.py | dslowikowski/commcare-hq | ad8885cf8dab69dc85cb64f37aeaf06106124797 | [
"BSD-3-Clause"
] | 1 | 2015-02-10T23:26:39.000Z | 2015-02-10T23:26:39.000Z | corehq/apps/accounting/migrations/0010_auto__chg_field_billingaccount_name.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | corehq/apps/accounting/migrations/0010_auto__chg_field_billingaccount_name.py | SEL-Columbia/commcare-hq | 992ee34a679c37f063f86200e6df5a197d5e3ff6 | [
"BSD-3-Clause"
] | null | null | null | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'BillingAccount.name'
db.alter_column(u'accounting_billingaccount', 'name', self.gf('djan... | 81.3 | 198 | 0.570558 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.alter_column(u'accounting_billingaccount', 'name', self.gf('django.db.models.fields.CharField')(max_length=200))
... | true | true |
1c351d62c4ba7e4ef4c5a90fea7c627e5ac13ffc | 1,096 | py | Python | sanaviron/src/3rd/pycha/tests/runner.py | StetHD/sanaviron | dcb5d3ac6725771942e669a29961ba3f811b7fd4 | [
"Apache-2.0"
] | null | null | null | sanaviron/src/3rd/pycha/tests/runner.py | StetHD/sanaviron | dcb5d3ac6725771942e669a29961ba3f811b7fd4 | [
"Apache-2.0"
] | null | null | null | sanaviron/src/3rd/pycha/tests/runner.py | StetHD/sanaviron | dcb5d3ac6725771942e669a29961ba3f811b7fd4 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2007-2008 by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of PyCha.
#
# PyCha is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License... | 29.621622 | 80 | 0.720803 |
import unittest
import bar
import chart
import color
import line
import pie
def test_suite():
return unittest.TestSuite((
bar.test_suite(),
chart.test_suite(),
color.test_suite(),
line.test_suite(),
pie.test_suite(),
))
if __name__ == '__main__':
... | true | true |
1c351d91fd998c54cbe1f7db8cc1ef7c336525d6 | 1,633 | py | Python | month01/面向对象/类和对象/day02/homework01.py | chaofan-zheng/python_leanring_code | 0af44ff39b9ded2c1d2cc96c6d356d21170ac04d | [
"Apache-2.0"
] | 4 | 2021-01-07T14:25:10.000Z | 2021-02-01T10:36:01.000Z | month01/面向对象/类和对象/day02/homework01.py | chaofan-zheng/python_leanring_code | 0af44ff39b9ded2c1d2cc96c6d356d21170ac04d | [
"Apache-2.0"
] | null | null | null | month01/面向对象/类和对象/day02/homework01.py | chaofan-zheng/python_leanring_code | 0af44ff39b9ded2c1d2cc96c6d356d21170ac04d | [
"Apache-2.0"
] | null | null | null | """
以面向对象的思想,描述下列情景.
(1)需求:小明使用手机打电话
(2)小明一次请多个保洁打扫卫生
效果:调用一次小明通知方法,可以有多个保洁在打扫卫生.
(3)张无忌教赵敏九阳神功
赵敏教张无忌玉女心经
张无忌工作挣了5000元
赵敏工作挣了10000元
"""
class Person:
def __init__(self, name):
self.name = name
def use_phone(self, phone):
phone.call()
class Phone:
def call(self):... | 17.945055 | 52 | 0.629516 |
class Person:
def __init__(self, name):
self.name = name
def use_phone(self, phone):
phone.call()
class Phone:
def call(self):
print("打电话")
xiaoming = Person("小明")
phone = Phone()
xiaoming.use_phone(phone)
print()
class People:
def __init__(self, name):
self.na... | true | true |
1c351dfa7f2fc57cc605e7d19dfea18fbc4b39ed | 748 | py | Python | var/spack/repos/builtin/packages/bc/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/bc/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 8 | 2021-11-09T20:28:40.000Z | 2022-03-15T03:26:33.000Z | var/spack/repos/builtin/packages/bc/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2019-02-08T20:37:20.000Z | 2019-03-31T15:19:26.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Bc(AutotoolsPackage, GNUMirrorPackage):
"""bc is an arbitrary precision numeric pr... | 32.521739 | 94 | 0.741979 |
from spack.package import *
class Bc(AutotoolsPackage, GNUMirrorPackage):
homepage = "https://www.gnu.org/software/bc"
gnu_mirror_path = "bc/bc-1.07.tar.gz"
version('1.07', sha256='55cf1fc33a728d7c3d386cc7b0cb556eb5bacf8e0cb5a3fcca7f109fc61205ad')
depends_on('ed', type='build')
depends_on(... | true | true |
1c3521323cf7d57dc8b2b240d95a181b90cc3144 | 1,188 | py | Python | src/recognizeDigit.py | RsTaK/Sudoku | 8daa0a06906ce61d9a71586a8d28a3931ca4e5e3 | [
"MIT"
] | 2 | 2020-01-22T14:32:40.000Z | 2021-12-23T20:42:52.000Z | src/recognizeDigit.py | RsTaK/Sudoku | 8daa0a06906ce61d9a71586a8d28a3931ca4e5e3 | [
"MIT"
] | 4 | 2020-11-13T18:54:24.000Z | 2022-02-10T02:10:00.000Z | src/recognizeDigit.py | RsTaK/Sudoku | 8daa0a06906ce61d9a71586a8d28a3931ca4e5e3 | [
"MIT"
] | 1 | 2020-01-22T14:02:50.000Z | 2020-01-22T14:02:50.000Z | from keras.models import load_model
import cv2
import pickle
import keras.backend as K
import numpy as np
from src.model_path import MODEL_PATH
'''def predict(self, cell):
model = load_model('./model/Model.h5')
f = K.function([model.layers[0].input, K.learning_phase()],[model.layers[-1].output])
rescaled_cell = ... | 27 | 87 | 0.705387 | from keras.models import load_model
import cv2
import pickle
import keras.backend as K
import numpy as np
from src.model_path import MODEL_PATH
class recognizeDigit:
def __init__(self, cell):
self._prediction = self.predict(cell)
def predict(self, cell):
model = load_model(MODEL_PATH)
rescaled_cell =... | true | true |
1c3521b67dec540553facf88ad2e9e97f1fee4e7 | 14,075 | py | Python | python/fate_test/fate_test/scripts/pipeline_conversion_cli.py | rubenlozanoaht3m/DataDogm | cd605e8072cca31e8418830c3300657ae2fa5b16 | [
"Apache-2.0"
] | 715 | 2019-01-24T10:52:03.000Z | 2019-10-31T12:19:22.000Z | python/fate_test/fate_test/scripts/pipeline_conversion_cli.py | rubenlozanoaht3m/DataDogm | cd605e8072cca31e8418830c3300657ae2fa5b16 | [
"Apache-2.0"
] | 270 | 2019-02-11T02:57:36.000Z | 2019-08-29T11:22:33.000Z | python/fate_test/fate_test/scripts/pipeline_conversion_cli.py | rubenlozanoaht3m/DataDogm | cd605e8072cca31e8418830c3300657ae2fa5b16 | [
"Apache-2.0"
] | 200 | 2019-01-26T14:21:35.000Z | 2019-11-01T01:14:36.000Z | import copy
import os
import shutil
import sys
import time
import uuid
import json
import click
import importlib
from fate_test._config import Config
from fate_test._io import LOGGER, echo
from fate_test.scripts._options import SharedOptions
@click.group(name="convert")
def convert_group():
"""
Converting pi... | 38.881215 | 120 | 0.601634 | import copy
import os
import shutil
import sys
import time
import uuid
import json
import click
import importlib
from fate_test._config import Config
from fate_test._io import LOGGER, echo
from fate_test.scripts._options import SharedOptions
@click.group(name="convert")
def convert_group():
...
@convert_group.... | true | true |
1c35235d2354af6cc9a378696a72c8e3440fb543 | 5,315 | py | Python | cnn_architectures/augmentation_4/eval_model_c10_leilaclip_aug4_560.py | leilayasmeen/MSc_Thesis | ee5e1782ab4a1d86c5dc0f5dc4111b4432ae204d | [
"MIT"
] | 2 | 2019-10-29T03:26:20.000Z | 2021-03-07T10:02:39.000Z | cnn_architectures/augmentation_4/eval_model_c10_leilaclip_aug4_560.py | leilayasmeen/MSc_Thesis | ee5e1782ab4a1d86c5dc0f5dc4111b4432ae204d | [
"MIT"
] | null | null | null | cnn_architectures/augmentation_4/eval_model_c10_leilaclip_aug4_560.py | leilayasmeen/MSc_Thesis | ee5e1782ab4a1d86c5dc0f5dc4111b4432ae204d | [
"MIT"
] | null | null | null | # Load in model weights and evaluate its goodness (ECE, MCE, error) also saves logits.
# ResNet model from https://github.com/BIGBALLON/cifar-10-cnn/blob/master/4_Residual_Network/ResNet_keras.py
import keras
import numpy as np
from keras.datasets import cifar10, cifar100
from keras.preprocessing.image import ImageDat... | 38.23741 | 132 | 0.660207 |
import keras
import numpy as np
from keras.datasets import cifar10, cifar100
from keras.preprocessing.image import ImageDataGenerator
from keras.layers.normalization import BatchNormalization
from keras.layers import Conv2D, Dense, Input, add, Activation, GlobalAveragePooling2D
from keras.callbacks import LearningRa... | true | true |
1c35238991c89b2303596c6026d78ebc7dc792de | 155 | py | Python | libtcodpy.py | Rakaneth/python-tcod | 70ff1895fd7ae87bf66f16e388211db389d983fd | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | libtcodpy.py | Rakaneth/python-tcod | 70ff1895fd7ae87bf66f16e388211db389d983fd | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | libtcodpy.py | Rakaneth/python-tcod | 70ff1895fd7ae87bf66f16e388211db389d983fd | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | """This module just an alias for tcod"""
import warnings
warnings.warn("`import tcod` is preferred.", DeprecationWarning, stacklevel=2)
from tcod import *
| 31 | 78 | 0.76129 | import warnings
warnings.warn("`import tcod` is preferred.", DeprecationWarning, stacklevel=2)
from tcod import *
| true | true |
1c3523fd8d02a1516ef4dd75b146e5fa3c73adca | 5,803 | py | Python | Supermicro/benchmarks/maskrcnn/implementations/pytorch_SYS-420GP-TNAR/maskrcnn_benchmark/modeling/matcher.py | gglin001/training_results_v1.1 | 58fd4103f0f465bda6eb56a06a74b7bbccbbcf24 | [
"Apache-2.0"
] | 48 | 2020-07-29T18:09:23.000Z | 2021-10-09T01:53:33.000Z | Supermicro/benchmarks/maskrcnn/implementations/pytorch_SYS-420GP-TNAR/maskrcnn_benchmark/modeling/matcher.py | gglin001/training_results_v1.1 | 58fd4103f0f465bda6eb56a06a74b7bbccbbcf24 | [
"Apache-2.0"
] | 21 | 2021-08-31T08:34:50.000Z | 2022-03-17T11:42:10.000Z | NVIDIA/benchmarks/maskrcnn/implementations/pytorch/maskrcnn_benchmark/modeling/matcher.py | lablup/training_results_v0.7 | f5bb59aa0f8b18b602763abe47d1d24d0d54b197 | [
"Apache-2.0"
] | 42 | 2020-08-01T06:41:24.000Z | 2022-01-20T10:33:08.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Copyright (c) 2018-2019 NVIDIA CORPORATION. All rights reserved.
import torch
from maskrcnn_benchmark import _C
class Matcher(object):
"""
This class assigns to each predicted "element" (e.g., a box) a ground-truth
element. Each pred... | 47.958678 | 161 | 0.639152 |
import torch
from maskrcnn_benchmark import _C
class Matcher(object):
BELOW_LOW_THRESHOLD = -1
BETWEEN_THRESHOLDS = -2
def __init__(self, high_threshold, low_threshold, allow_low_quality_matches=False):
assert low_threshold <= high_threshold
self.high_threshold = high_threshold
... | true | true |
1c3524bc34295eb32e34de4b5a895a6a729a82bc | 469 | py | Python | Algorithms/Implementation/Apple_and_Orange/main.py | ugurcan-sonmez-95/HackerRank_Problems | 187d83422128228c241f279096386df5493d539d | [
"MIT"
] | null | null | null | Algorithms/Implementation/Apple_and_Orange/main.py | ugurcan-sonmez-95/HackerRank_Problems | 187d83422128228c241f279096386df5493d539d | [
"MIT"
] | null | null | null | Algorithms/Implementation/Apple_and_Orange/main.py | ugurcan-sonmez-95/HackerRank_Problems | 187d83422128228c241f279096386df5493d539d | [
"MIT"
] | null | null | null | ### Apple and Orange - Solution
def countApplesAndOranges(*args):
count = (sum(s <= (a+i) <= t for i in list_apple), sum(s <= (b+j) <= t for j in list_orange))
print(*count, sep='\n')
s, t = map(int, input().split())
a, b = map(int, input().split())
apples, oranges = map(int, input().split())
list_apple = tup... | 39.083333 | 97 | 0.646055 | a+i) <= t for i in list_apple), sum(s <= (b+j) <= t for j in list_orange))
print(*count, sep='\n')
s, t = map(int, input().split())
a, b = map(int, input().split())
apples, oranges = map(int, input().split())
list_apple = tuple(map(int, input().split()[:apples]))
list_orange = tuple(map(int, input().split()[:orang... | true | true |
1c3524d3b7d89fd9ea3d4786c0b184c1ef7629b3 | 598 | py | Python | pbx_gs_python_utils/utils/Process.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 3 | 2018-12-14T15:43:46.000Z | 2019-04-25T07:44:58.000Z | pbx_gs_python_utils/utils/Process.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 1 | 2019-05-11T14:19:37.000Z | 2019-05-11T14:51:04.000Z | pbx_gs_python_utils/utils/Process.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 4 | 2018-12-27T04:54:14.000Z | 2019-05-11T14:07:47.000Z | import os
import signal
import subprocess
class Process:
@staticmethod
def run(executable, params = [], cwd='.'):
run_params = [executable] + params
result = subprocess.run(run_params, cwd = cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return {
"runParams" : ... | 27.181818 | 107 | 0.593645 | import os
import signal
import subprocess
class Process:
@staticmethod
def run(executable, params = [], cwd='.'):
run_params = [executable] + params
result = subprocess.run(run_params, cwd = cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return {
"runParams" : ... | true | true |
1c35250043d955c5b423451551b1a24c66b4c5d2 | 24,594 | py | Python | unit_tests/test_charms_openstack_devices_pci.py | cloud-padawan/charms.openstack | 1fe4e411cf1ebc5b89e69af0cbac5e4045811ef8 | [
"Apache-2.0"
] | null | null | null | unit_tests/test_charms_openstack_devices_pci.py | cloud-padawan/charms.openstack | 1fe4e411cf1ebc5b89e69af0cbac5e4045811ef8 | [
"Apache-2.0"
] | null | null | null | unit_tests/test_charms_openstack_devices_pci.py | cloud-padawan/charms.openstack | 1fe4e411cf1ebc5b89e69af0cbac5e4045811ef8 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Canonical Ltd
#
# 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, s... | 43.996422 | 77 | 0.65703 |
from __future__ import absolute_import
import mock
import charms_openstack.devices.pci as pci
import unit_tests.pci_responses as pci_responses
import unit_tests.utils as utils
def mocked_subprocess(subproc_map=None):
def _subproc(cmd, stdin=None):
for key in pci_responses.COMMANDS.k... | true | true |
1c352504ad483c694312e26f2b9ee3495b840de3 | 450 | py | Python | cui/symbols.py | clandgraf/cui | 2073e56e6f0a6d1278207b583bfc3f15a08a5ca5 | [
"BSD-3-Clause"
] | null | null | null | cui/symbols.py | clandgraf/cui | 2073e56e6f0a6d1278207b583bfc3f15a08a5ca5 | [
"BSD-3-Clause"
] | null | null | null | cui/symbols.py | clandgraf/cui | 2073e56e6f0a6d1278207b583bfc3f15a08a5ca5 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2017 Christoph Landgraf. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Symbol(object):
def __hash__(self):
return id(self)
def __eq__(self, other):
return id(self) == id(other)
SYM_VL... | 25 | 73 | 0.666667 |
class Symbol(object):
def __hash__(self):
return id(self)
def __eq__(self, other):
return id(self) == id(other)
SYM_VLINE = Symbol()
SYM_HLINE = Symbol()
SYM_LLCORNER = Symbol()
SYM_LTEE = Symbol()
SYM_RARROW = Symbol()
SYM_DARROW = Symbol()
| true | true |
1c352709362d8ae28f08359cb49eba77cb85c6cb | 4,638 | py | Python | auth-api/src/auth_api/__init__.py | thorwolpert/sbc-auth | 5da50cde2e5625d1b0ceea090c3656ee374c9b71 | [
"Apache-2.0"
] | 11 | 2019-09-26T06:58:25.000Z | 2022-01-26T06:19:39.000Z | auth-api/src/auth_api/__init__.py | thorwolpert/sbc-auth | 5da50cde2e5625d1b0ceea090c3656ee374c9b71 | [
"Apache-2.0"
] | 1,622 | 2019-05-07T21:08:38.000Z | 2022-03-28T17:07:15.000Z | auth-api/src/auth_api/__init__.py | thorwolpert/sbc-auth | 5da50cde2e5625d1b0ceea090c3656ee374c9b71 | [
"Apache-2.0"
] | 98 | 2019-03-01T21:36:15.000Z | 2021-12-01T22:11:25.000Z | # Copyright © 2019 Province of British Columbia
#
# 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 agr... | 35.136364 | 108 | 0.709142 |
import json
import os
import sentry_sdk
from flask import Flask, g, request
from humps.main import camelize
from sbc_common_components.exception_handling.exception_handler import ExceptionHandler
from sentry_sdk.integrations.flask import FlaskIntegration
import auth_api.config as config
from aut... | true | true |
1c35273f22524824a1badec9f7b8ab86d3ec0258 | 12,655 | py | Python | Staff.py | iGuan7u/HRScript | 53ac7b6865623713ffadb22ff0620d63f87c3313 | [
"MIT"
] | null | null | null | Staff.py | iGuan7u/HRScript | 53ac7b6865623713ffadb22ff0620d63f87c3313 | [
"MIT"
] | null | null | null | Staff.py | iGuan7u/HRScript | 53ac7b6865623713ffadb22ff0620d63f87c3313 | [
"MIT"
] | null | null | null | from SheetHelper import SheetHelper
class Staff:
# 姓名
name = ''
# 工作地点
workPlace = ''
# 中心
center = ''
# 部门
department = ''
# 科室
administration = ''
# 组
group = ''
# 一级主管
leader = ''
# 用户名
userName = ''
# OA
OAName = ''
# 英文名
englishName =... | 31.558603 | 149 | 0.616041 | from SheetHelper import SheetHelper
class Staff:
name = ''
workPlace = ''
center = ''
department = ''
administration = ''
group = ''
leader = ''
userName = ''
OAName = ''
englishName = ''
state = '在职'
nation = '... | true | true |
1c3527b72a8c9842e102fa8eb962fbb3b769d1c1 | 3,224 | py | Python | pytmatrix/tmatrix_aux.py | DaveOri/pytmatrix | 0287a41d49ff3a34d5309f5f832183f37b24276d | [
"MIT"
] | 64 | 2015-03-09T18:35:52.000Z | 2022-02-28T22:01:40.000Z | pytmatrix/tmatrix_aux.py | DaveOri/pytmatrix | 0287a41d49ff3a34d5309f5f832183f37b24276d | [
"MIT"
] | 22 | 2015-03-09T19:08:47.000Z | 2022-01-19T08:10:10.000Z | pytmatrix/tmatrix_aux.py | DaveOri/pytmatrix | 0287a41d49ff3a34d5309f5f832183f37b24276d | [
"MIT"
] | 38 | 2015-01-29T13:22:32.000Z | 2022-02-17T07:47:06.000Z | """
Copyright (C) 2009-2015 Jussi Leinonen, Finnish Meteorological Institute,
California Institute of Technology
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 wit... | 34.297872 | 80 | 0.694479 |
VERSION = "0.3.2"
wl_S = 111.0
wl_C = 53.5
wl_X = 33.3
wl_Ku = 22.0
wl_Ka = 8.43
wl_W = 3.19
K_w_sqr = {wl_S: 0.93, wl_C: 0.93, wl_X: 0.93, wl_Ku: 0.93, wl_Ka: 0.92,
wl_W: 0.75}
geom_horiz_back = (90.0, 90.0, 0.0, 180.0, 0.0, 0.0)
geom_horiz_forw = (90.0, 90.0, 0.0, 0.0, 0.0, 0.0)
geom_vert_back = (0.0, 18... | true | true |
1c3528b330d6d52f1eafee2cbedada808d989220 | 3,093 | py | Python | src/iago/Parser.py | ferchault/iago | fc853eab7820df18d20b653acdc09c156dc152e1 | [
"MIT"
] | null | null | null | src/iago/Parser.py | ferchault/iago | fc853eab7820df18d20b653acdc09c156dc152e1 | [
"MIT"
] | 18 | 2016-10-09T14:48:28.000Z | 2017-05-08T06:34:24.000Z | src/iago/Parser.py | ferchault/iago | fc853eab7820df18d20b653acdc09c156dc152e1 | [
"MIT"
] | null | null | null | # standard modules
import os
import re
# custom modules
import Reader
class Parser(object):
def __init__(self):
self._readers = dict()
self.path = None
self.runmatch = dict()
self._runcache = None
def get_atom_indices(self, selector):
"""
:param selector: Valid selection string.
:return: List of 0-b... | 29.457143 | 113 | 0.696088 |
import os
import re
import Reader
class Parser(object):
def __init__(self):
self._readers = dict()
self.path = None
self.runmatch = dict()
self._runcache = None
def get_atom_indices(self, selector):
u = self._readers.itervalues().next().get_universe()
if isinstance(u, Reader.EmptyUniverse):
retur... | true | true |
1c3528b5e4cac10d724e001938a99d7a640d8dbd | 684 | py | Python | core/pages/header/header.py | mmihailicenko/selenium-pytest-framework | 9487ae4911e8ac7f6a69028603d31b347f182f47 | [
"MIT"
] | 1 | 2021-07-26T06:28:30.000Z | 2021-07-26T06:28:30.000Z | core/pages/header/header.py | mmihailicenko/selenium-pytest-framework | 9487ae4911e8ac7f6a69028603d31b347f182f47 | [
"MIT"
] | null | null | null | core/pages/header/header.py | mmihailicenko/selenium-pytest-framework | 9487ae4911e8ac7f6a69028603d31b347f182f47 | [
"MIT"
] | null | null | null | from selenium.webdriver.common.by import By
from core.pages.base_page import BasePage
from core.pages.main.main_page import MainPage
class Header(BasePage):
LOGO_TITLE = (By.CSS_SELECTOR, "#logo .title")
SEARCH_FIELD = (By.CSS_SELECTOR, ".search-field")
SEARCH_SUBMIT_BTN = (By.CSS_SELECTOR, ".search-sub... | 28.5 | 62 | 0.701754 | from selenium.webdriver.common.by import By
from core.pages.base_page import BasePage
from core.pages.main.main_page import MainPage
class Header(BasePage):
LOGO_TITLE = (By.CSS_SELECTOR, "#logo .title")
SEARCH_FIELD = (By.CSS_SELECTOR, ".search-field")
SEARCH_SUBMIT_BTN = (By.CSS_SELECTOR, ".search-sub... | true | true |
1c35292b72892e1eb6c4d0cd70aa67d1eef3aca7 | 3,085 | py | Python | Codes/recognition/lib/models/crnn.py | hsupengbo/201800130086_spring_NNML | c51d074c2d33650cc923ccc4297ecbce31c83df7 | [
"MIT"
] | 3 | 2021-12-15T06:57:46.000Z | 2022-03-16T06:26:16.000Z | Codes/recognition/lib/models/crnn.py | pengbohsu/201800130086_spring_NNML | c51d074c2d33650cc923ccc4297ecbce31c83df7 | [
"MIT"
] | 2 | 2021-12-15T07:34:34.000Z | 2022-03-16T06:24:21.000Z | Codes/recognition/lib/models/crnn.py | pengbohsu/201800130086_spring_NNML | c51d074c2d33650cc923ccc4297ecbce31c83df7 | [
"MIT"
] | null | null | null | import torch.nn as nn
import torch.nn.functional as F
class BidirectionalLSTM(nn.Module):
# Inputs hidden units Out
def __init__(self, nIn, nHidden, nOut):
super(BidirectionalLSTM, self).__init__()
self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True)
self.embedding = nn.Linear(nHidden... | 32.135417 | 101 | 0.540357 | import torch.nn as nn
import torch.nn.functional as F
class BidirectionalLSTM(nn.Module):
def __init__(self, nIn, nHidden, nOut):
super(BidirectionalLSTM, self).__init__()
self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True)
self.embedding = nn.Linear(nHidden * 2, nOut)
def forw... | true | true |
1c35298fcc6b85b9e74eaf2e56505004f4529ad7 | 14,679 | py | Python | pandas/core/arrays/numpy_.py | kadekillary/pandas | f6a5dd4b8c450d73f3bec964b05cca32cef4bb71 | [
"BSD-3-Clause"
] | 1 | 2019-12-27T01:54:53.000Z | 2019-12-27T01:54:53.000Z | pandas/core/arrays/numpy_.py | kadekillary/pandas | f6a5dd4b8c450d73f3bec964b05cca32cef4bb71 | [
"BSD-3-Clause"
] | null | null | null | pandas/core/arrays/numpy_.py | kadekillary/pandas | f6a5dd4b8c450d73f3bec964b05cca32cef4bb71 | [
"BSD-3-Clause"
] | null | null | null | import numbers
import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from pandas._libs import lib
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender
from pandas.util._validators import validate_fillna_kwargs
from pandas.core.dtypes.dtypes import ExtensionDtype... | 31.635776 | 88 | 0.592138 | import numbers
import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from pandas._libs import lib
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender
from pandas.util._validators import validate_fillna_kwargs
from pandas.core.dtypes.dtypes import ExtensionDtype... | true | true |
1c352997b3488b4665bffd9224d7f607f1c9e05d | 8,158 | py | Python | lib/datasets/voc_eval.py | zyuerugou/tf-faster-rcnn | 6d1e3d9691ad3dd570e56a77304fc307969dc0f3 | [
"MIT"
] | null | null | null | lib/datasets/voc_eval.py | zyuerugou/tf-faster-rcnn | 6d1e3d9691ad3dd570e56a77304fc307969dc0f3 | [
"MIT"
] | null | null | null | lib/datasets/voc_eval.py | zyuerugou/tf-faster-rcnn | 6d1e3d9691ad3dd570e56a77304fc307969dc0f3 | [
"MIT"
] | null | null | null | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import pr... | 33.02834 | 97 | 0.511522 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import xml.etree.ElementTree as ET
import os
import pickle
import numpy as np
def parse_rec(filename):
tree = ET.parse(filename)
objects = []
print('obj class:')
for obj in tree.findall('ob... | true | true |
1c352997d01a22505572c0627be711f3de4d8a1d | 737 | py | Python | kubragen2/tests/test_options.py | RangelReale/kubragen2 | 2118f1429a9b9da937582db1f41d4f12b78773e2 | [
"MIT"
] | 1 | 2022-02-14T07:31:57.000Z | 2022-02-14T07:31:57.000Z | kubragen2/tests/test_options.py | RangelReale/kubragen2 | 2118f1429a9b9da937582db1f41d4f12b78773e2 | [
"MIT"
] | null | null | null | kubragen2/tests/test_options.py | RangelReale/kubragen2 | 2118f1429a9b9da937582db1f41d4f12b78773e2 | [
"MIT"
] | null | null | null | import copy
import unittest
from kubragen2.options import Options, OptionValue, OptionsBuildData
class TestUtil(unittest.TestCase):
def test_option_merge(self):
options = Options({
'x': {
'y': OptionValue('x.z'),
'z': 14,
}
}, {
... | 24.566667 | 72 | 0.466757 | import copy
import unittest
from kubragen2.options import Options, OptionValue, OptionsBuildData
class TestUtil(unittest.TestCase):
def test_option_merge(self):
options = Options({
'x': {
'y': OptionValue('x.z'),
'z': 14,
}
}, {
... | true | true |
1c352a37c5aeb60e9672cf6ce32cb450212169fe | 501 | py | Python | example/NaCl/NaCl-yaml.py | ladyteam/phonopy | 455ef61dfa15c01fb6b516461b52f15aefbf92b3 | [
"BSD-3-Clause"
] | 127 | 2015-01-21T17:50:58.000Z | 2020-02-04T13:46:13.000Z | example/NaCl/NaCl-yaml.py | ladyteam/phonopy | 455ef61dfa15c01fb6b516461b52f15aefbf92b3 | [
"BSD-3-Clause"
] | 100 | 2015-02-07T15:32:50.000Z | 2020-02-23T02:09:08.000Z | example/NaCl/NaCl-yaml.py | ladyteam/phonopy | 455ef61dfa15c01fb6b516461b52f15aefbf92b3 | [
"BSD-3-Clause"
] | 122 | 2015-02-07T15:39:28.000Z | 2020-02-10T22:33:16.000Z | """Example to obtain PhonopyYaml instance."""
import phonopy
from phonopy.interface.phonopy_yaml import PhonopyYaml
phonon = phonopy.load(
supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]],
primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]],
unitcell_filename="POSCAR-unitcell",
force_sets_... | 33.4 | 78 | 0.700599 | import phonopy
from phonopy.interface.phonopy_yaml import PhonopyYaml
phonon = phonopy.load(
supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]],
primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]],
unitcell_filename="POSCAR-unitcell",
force_sets_filename="FORCE_SETS",
born_filename="BORN... | true | true |
1c352afc280d330d2ed09810169d30a1a948c30d | 19,808 | py | Python | infra/bots/recipe_modules/flavor/gn_android_flavor.py | despairblue/esy-skia | 1c81aac298602f8e872c1079db92868199b6394f | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | infra/bots/recipe_modules/flavor/gn_android_flavor.py | despairblue/esy-skia | 1c81aac298602f8e872c1079db92868199b6394f | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | infra/bots/recipe_modules/flavor/gn_android_flavor.py | despairblue/esy-skia | 1c81aac298602f8e872c1079db92868199b6394f | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_api
import default_flavor
import re
import subprocess
"""GN Android flavor utils, used for building Skia for Android with... | 36.613678 | 82 | 0.632977 |
from recipe_engine import recipe_api
import default_flavor
import re
import subprocess
class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
def __init__(self, m):
super(GNAndroidFlavorUtils, self).__init__(m)
self._ever_ran_adb = False
self.ADB_BINARY = '/usr/bin/adb.1.0.35'
self.ADB_... | true | true |
1c352b0a9797bacca4a2027a8e3d37c33bdafbd4 | 204 | py | Python | dicodile/data/tests/test_gait.py | hndgzkn/dicodile | 799f3fe244609d4699109a42956bf1ab97778e6c | [
"BSD-3-Clause"
] | 15 | 2019-02-04T19:55:41.000Z | 2021-12-28T14:27:42.000Z | dicodile/data/tests/test_gait.py | hndgzkn/dicodile | 799f3fe244609d4699109a42956bf1ab97778e6c | [
"BSD-3-Clause"
] | 47 | 2021-01-12T09:41:15.000Z | 2022-03-10T10:33:48.000Z | dicodile/data/tests/test_gait.py | hndgzkn/dicodile | 799f3fe244609d4699109a42956bf1ab97778e6c | [
"BSD-3-Clause"
] | 7 | 2019-05-06T15:21:55.000Z | 2021-04-22T09:53:45.000Z | from dicodile.data.gait import get_gait_data
def test_get_gait():
trial = get_gait_data()
assert trial['Subject'] == 1
assert trial['Trial'] == 1
assert len(trial['data'].columns) == 16
| 22.666667 | 44 | 0.666667 | from dicodile.data.gait import get_gait_data
def test_get_gait():
trial = get_gait_data()
assert trial['Subject'] == 1
assert trial['Trial'] == 1
assert len(trial['data'].columns) == 16
| true | true |
1c352b4e88322157cacafc5f554a325bea421e51 | 1,155 | py | Python | clients/client/python/test/test_submit_self_service_login_flow_with_lookup_secret_method_body.py | tobbbles/sdk | 017ca2fd46019bafd1853913b6c0f2b0fe687621 | [
"Apache-2.0"
] | null | null | null | clients/client/python/test/test_submit_self_service_login_flow_with_lookup_secret_method_body.py | tobbbles/sdk | 017ca2fd46019bafd1853913b6c0f2b0fe687621 | [
"Apache-2.0"
] | null | null | null | clients/client/python/test/test_submit_self_service_login_flow_with_lookup_secret_method_body.py | tobbbles/sdk | 017ca2fd46019bafd1853913b6c0f2b0fe687621 | [
"Apache-2.0"
] | null | null | null | """
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.18
Contact: support@ory.sh
Generated by: htt... | 31.216216 | 194 | 0.769697 |
import sys
import unittest
import ory_client
from ory_client.model.submit_self_service_login_flow_with_lookup_secret_method_body import SubmitSelfServiceLoginFlowWithLookupSecretMethodBody
class TestSubmitSelfServiceLoginFlowWithLookupSecretMethodBody(unittest.TestCase):
def setUp(self):
pass
def... | true | true |
1c352be446d9cc123b14ae4b032878c1de524b88 | 3,665 | py | Python | pycaret/tests/test_time_series_tune_base.py | AJarman/pycaret | e96fefbf95c9e0195ec07ea63ebe25a8ce98baf3 | [
"MIT"
] | null | null | null | pycaret/tests/test_time_series_tune_base.py | AJarman/pycaret | e96fefbf95c9e0195ec07ea63ebe25a8ce98baf3 | [
"MIT"
] | null | null | null | pycaret/tests/test_time_series_tune_base.py | AJarman/pycaret | e96fefbf95c9e0195ec07ea63ebe25a8ce98baf3 | [
"MIT"
] | null | null | null | """Module to test time_series "tune_model" BASE functionality
"""
import pytest
import numpy as np
import pandas as pd
from pycaret.internal.pycaret_experiment import TimeSeriesExperiment
from .time_series_test_utils import _ALL_METRICS
##########################
#### Tests Start Here ####
########################... | 27.350746 | 102 | 0.655389 |
import pytest
import numpy as np
import pandas as pd
from pycaret.internal.pycaret_experiment import TimeSeriesExperiment
from .time_series_test_utils import _ALL_METRICS
assert tuned_model2.strategy != model.strategy
def test_tune_model_custom_folds(load_pos_and_neg_data):
exp = TimeSeriesExpe... | true | true |
1c352bf374538b5e35d40deb826562eb2decc543 | 2,226 | py | Python | handlers/handlers.py | waleko/libreta | 323d20c52d676a36f47df70f0909eb2bbb7ab753 | [
"Apache-2.0"
] | null | null | null | handlers/handlers.py | waleko/libreta | 323d20c52d676a36f47df70f0909eb2bbb7ab753 | [
"Apache-2.0"
] | null | null | null | handlers/handlers.py | waleko/libreta | 323d20c52d676a36f47df70f0909eb2bbb7ab753 | [
"Apache-2.0"
] | null | null | null | from typing import List
from telegram import Update
from telegram.ext import Handler, CallbackContext, ConversationHandler
from strings import Strings
from utils.dao import Dao
handlers: List[Handler] = []
def register_unprotected_handler(handler: Handler):
"""
Adds given handler to `Bot`
"""
handl... | 30.493151 | 76 | 0.651842 | from typing import List
from telegram import Update
from telegram.ext import Handler, CallbackContext, ConversationHandler
from strings import Strings
from utils.dao import Dao
handlers: List[Handler] = []
def register_unprotected_handler(handler: Handler):
handlers.append(handler)
def add_authguard_to_handl... | true | true |
1c352bfb1e5e73fc26b875533846ebf2be26997b | 43 | py | Python | pipex/storages/h5storage/__init__.py | Algy/pipex | 02b958f67b32cad4a492d098a2ed73f971c6ac5f | [
"MIT"
] | 3 | 2018-12-24T03:48:40.000Z | 2018-12-24T04:07:36.000Z | pipex/storages/h5storage/__init__.py | Algy/pipex | 02b958f67b32cad4a492d098a2ed73f971c6ac5f | [
"MIT"
] | 2 | 2021-03-18T21:56:12.000Z | 2021-09-08T00:47:14.000Z | pipex/storages/h5storage/__init__.py | Algy/pipex | 02b958f67b32cad4a492d098a2ed73f971c6ac5f | [
"MIT"
] | null | null | null | from .h5storage import H5Storage, H5Bucket
| 21.5 | 42 | 0.837209 | from .h5storage import H5Storage, H5Bucket
| true | true |
1c352c2f63bd95f0122ababeaffcc414d0aab268 | 271 | py | Python | tests/test_signals.py | marazmiki/django-disguise | 35ee8f883d198292911a3e996d7920ab4faa3db8 | [
"MIT"
] | 1 | 2015-04-04T22:14:53.000Z | 2015-04-04T22:14:53.000Z | tests/test_signals.py | marazmiki/django-disguise | 35ee8f883d198292911a3e996d7920ab4faa3db8 | [
"MIT"
] | 2 | 2019-10-03T04:54:52.000Z | 2020-02-11T23:57:02.000Z | tests/test_signals.py | marazmiki/django-disguise | 35ee8f883d198292911a3e996d7920ab4faa3db8 | [
"MIT"
] | 1 | 2018-03-05T17:41:48.000Z | 2018-03-05T17:41:48.000Z | from django.contrib.auth.models import Permission
from django.db.models.signals import post_save
def test_permission():
qs = Permission.objects.filter(codename='can_disguise')
assert not qs.exists()
post_save.send(sender=Permission)
assert qs.exists()
| 24.636364 | 59 | 0.760148 | from django.contrib.auth.models import Permission
from django.db.models.signals import post_save
def test_permission():
qs = Permission.objects.filter(codename='can_disguise')
assert not qs.exists()
post_save.send(sender=Permission)
assert qs.exists()
| true | true |
1c352e16362790d4730bcd25c38138a601edc85d | 1,192 | py | Python | tests/utils/path.py | lise1020/pybinding | 921d5c2ac0ecc0ef317ba28b0bf68899ea30709a | [
"BSD-2-Clause"
] | 159 | 2016-01-20T17:40:48.000Z | 2022-03-24T06:08:55.000Z | tests/utils/path.py | deilynazar/pybinding | ec1128aaa84a1b43a74fb970479ce4544bd63179 | [
"BSD-2-Clause"
] | 36 | 2016-11-01T17:15:12.000Z | 2022-03-08T14:31:51.000Z | tests/utils/path.py | deilynazar/pybinding | ec1128aaa84a1b43a74fb970479ce4544bd63179 | [
"BSD-2-Clause"
] | 57 | 2016-04-23T22:12:01.000Z | 2022-03-08T12:33:04.000Z | import pathlib
def path_from_fixture(request, prefix, variant='', ext='', override_group=''):
"""Use a fixture's `request` argument to create a unique file path
The final return path will look like:
prefix/module_name/test_name[fixture_param]variant.ext
Parameters
----------
request
... | 32.216216 | 89 | 0.646812 | import pathlib
def path_from_fixture(request, prefix, variant='', ext='', override_group=''):
test_dir = pathlib.Path(str(request.fspath.join('..')))
module_name = request.module.__name__.split('.')[-1].replace('test_', '')
name = request.node.name.replace('test_', '') + variant
if override_group:
... | true | true |
1c35309bac56e128d6e052406d3a7d5cd066fd49 | 302 | py | Python | util/arrays.py | cassianobecker/dnn | bb2ea04f77733de9df10f795bb049ac3b9d30478 | [
"MIT"
] | 3 | 2020-02-21T21:35:07.000Z | 2020-09-29T15:20:00.000Z | util/arrays.py | cassianobecker/dnn | bb2ea04f77733de9df10f795bb049ac3b9d30478 | [
"MIT"
] | 27 | 2020-02-20T21:00:23.000Z | 2020-05-22T15:23:25.000Z | util/arrays.py | cassianobecker/dnn | bb2ea04f77733de9df10f795bb049ac3b9d30478 | [
"MIT"
] | null | null | null | def slice_from_list_of_pairs(pair_list, null_offset=None):
slice_list = []
if null_offset is not None:
for _ in range(null_offset):
slice_list.append(slice(None))
for pair in pair_list:
slice_list.append(slice(pair[0], pair[1]))
return tuple(slice_list)
| 23.230769 | 58 | 0.662252 | def slice_from_list_of_pairs(pair_list, null_offset=None):
slice_list = []
if null_offset is not None:
for _ in range(null_offset):
slice_list.append(slice(None))
for pair in pair_list:
slice_list.append(slice(pair[0], pair[1]))
return tuple(slice_list)
| true | true |
1c35321a8dd538f3952867cc9a3e9b9162013ea8 | 1,043 | py | Python | machine-learning-az/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/categorical_data.py | tapiwam/dataSciProjects | 55d6fb348bc63acacfa0510ffd9787ecf49e0495 | [
"MIT"
] | null | null | null | machine-learning-az/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/categorical_data.py | tapiwam/dataSciProjects | 55d6fb348bc63acacfa0510ffd9787ecf49e0495 | [
"MIT"
] | null | null | null | machine-learning-az/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/categorical_data.py | tapiwam/dataSciProjects | 55d6fb348bc63acacfa0510ffd9787ecf49e0495 | [
"MIT"
] | null | null | null | # Data Preprocessing
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
# Taking care of missing data
from sklearn.preprocessing import Imputer
imputer... | 29.8 | 84 | 0.746884 |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
from sklearn.preprocessing import Imputer
imputer = Imputer(missing_values = 'NaN', strategy = 'mean', axis = 0)
imputer = imputer.fit(X[:, 1:3])
... | true | true |
1c35323ca460d4043b0045be8eb077516d2d70f2 | 1,658 | py | Python | src/config.py | shuu-tatsu/qagan | 15c76655cfecba4f6073940728d930b58a305eec | [
"MIT"
] | null | null | null | src/config.py | shuu-tatsu/qagan | 15c76655cfecba4f6073940728d930b58a305eec | [
"MIT"
] | 1 | 2019-04-02T06:13:33.000Z | 2019-04-02T06:13:33.000Z | src/config.py | shuu-tatsu/qagan | 15c76655cfecba4f6073940728d930b58a305eec | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import torch
parser = argparse.ArgumentParser()
# GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# File
target_dir = '../data/'
train_file = target_dir + '/msmarco/train_v2.1.json'
dev_file = target_dir + '/msmarco/dev_v2.1.j... | 37.681818 | 88 | 0.749095 |
import argparse
import torch
parser = argparse.ArgumentParser()
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
target_dir = '../data/'
train_file = target_dir + '/msmarco/train_v2.1.json'
dev_file = target_dir + '/msmarco/dev_v2.1.json'
eval_file = target_dir + '/msmarco/eval_v2.1_public... | true | true |
1c35325f170029556775761a4723544e43364755 | 18,617 | py | Python | analyzer/libs/pygments/pygments/lexers/html.py | oslab-swrc/juxta | 481cd6f01e87790041a07379805968bcf57d75f4 | [
"MIT"
] | 23 | 2016-01-06T07:01:46.000Z | 2022-02-12T15:53:20.000Z | analyzer/libs/pygments/pygments/lexers/html.py | oslab-swrc/juxta | 481cd6f01e87790041a07379805968bcf57d75f4 | [
"MIT"
] | 1 | 2019-04-02T00:42:29.000Z | 2019-04-02T00:42:29.000Z | analyzer/libs/pygments/pygments/lexers/html.py | oslab-swrc/juxta | 481cd6f01e87790041a07379805968bcf57d75f4 | [
"MIT"
] | 16 | 2016-01-06T07:01:46.000Z | 2021-11-29T11:43:16.000Z | # -*- coding: utf-8 -*-
"""
pygments.lexers.html
~~~~~~~~~~~~~~~~~~~~
Lexers for HTML, XML and related markup.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, ExtendedRegexLexer, inclu... | 31.554237 | 83 | 0.41258 |
import re
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
default, using
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Punctuation
from pygments.util import looks_like_xml, html_doctype_matches
from pygments.lexers.javascript import JavascriptLe... | true | true |
1c3532f6e51f3e4e021302188e96be49eb686017 | 4,642 | py | Python | sdk/python/pulumi_aws/dynamodb/global_table.py | Dominik-K/pulumi-aws | efb5e2a48a86baba58e373ade5863c0f45389c29 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/dynamodb/global_table.py | Dominik-K/pulumi-aws | efb5e2a48a86baba58e373ade5863c0f45389c29 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/dynamodb/global_table.py | Dominik-K/pulumi-aws | efb5e2a48a86baba58e373ade5863c0f45389c29 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Global... | 45.067961 | 291 | 0.673847 |
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class GlobalTable(pulumi.CustomResource):
arn: pulumi.Output[str]
name: pulumi.Output[str]
replicas: pulumi.Output[list]
def __init__(__self__, resource_name, opts=None, name=No... | true | true |
1c3533381d19c145ed61b41772342c7e6675c738 | 5,199 | py | Python | tensorflow_datasets/image_classification/oxford_iiit_pet.py | daniel-trejobanos/tf-ds-321 | e3f5b1771a176dc552c3a99f51f3a5ffbe105852 | [
"Apache-2.0"
] | 2 | 2020-10-12T07:09:38.000Z | 2021-03-05T12:48:23.000Z | tensorflow_datasets/image_classification/oxford_iiit_pet.py | javierespinozat/datasets | 1465d97b2e8b2a030f5df7872e8390b90dba8926 | [
"Apache-2.0"
] | null | null | null | tensorflow_datasets/image_classification/oxford_iiit_pet.py | javierespinozat/datasets | 1465d97b2e8b2a030f5df7872e8390b90dba8926 | [
"Apache-2.0"
] | 1 | 2021-06-30T17:45:23.000Z | 2021-06-30T17:45:23.000Z | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 36.356643 | 86 | 0.655703 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_DESCRIPTION = """\
The Oxford-IIIT pet dataset is a 37 category pet image dataset with roughly 200... | true | true |
1c3533c7e05e40ac6b283f54f736a327f5fdab87 | 154 | py | Python | Leetcode/0914. X of a Kind in a Deck of Cards/0914.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/0914. X of a Kind in a Deck of Cards/0914.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/0914. X of a Kind in a Deck of Cards/0914.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | class Solution:
def hasGroupsSizeX(self, deck: List[int]) -> bool:
count = Counter(deck)
return functools.reduce(math.gcd, count.values()) >= 2
| 30.8 | 58 | 0.681818 | class Solution:
def hasGroupsSizeX(self, deck: List[int]) -> bool:
count = Counter(deck)
return functools.reduce(math.gcd, count.values()) >= 2
| true | true |
1c353430554f30c2e65b41c56de5fa9c108a644d | 853 | py | Python | selfservice-api/src/selfservice_api/services/external/models/__init__.py | bcgov/BCSC-BPS | 3bfe09c100a0f5b98d61228324336d5f45ad93ad | [
"Apache-2.0"
] | 2 | 2020-07-03T18:18:34.000Z | 2021-03-08T10:25:50.000Z | selfservice-api/src/selfservice_api/services/external/models/__init__.py | bcgov/BCSC-BPS | 3bfe09c100a0f5b98d61228324336d5f45ad93ad | [
"Apache-2.0"
] | 312 | 2020-01-10T23:00:08.000Z | 2022-03-29T22:07:00.000Z | selfservice-api/src/selfservice_api/services/external/models/__init__.py | bcgov/BCSC-BPS | 3bfe09c100a0f5b98d61228324336d5f45ad93ad | [
"Apache-2.0"
] | 2 | 2020-03-26T05:10:20.000Z | 2021-02-05T19:22:56.000Z | # Copyright © 2019 Province of British Columbia
#
# 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 agr... | 44.894737 | 74 | 0.793669 |
from .dynamic_client_create import CreateRequestModel, CreateResponseModel
from .dynamic_client_get import GetResponseModel
from .dynamic_client_update import UpdateRequestModel, UpdateResponseModel
| true | true |
1c3534e51791e7e9bbfa8e8618d8af7c902e6529 | 6,211 | py | Python | billy/tests/importers/test_utils.py | backwardn/billy | 07ac788d25a6c79d03dd0e3d55459bbb55e22439 | [
"BSD-3-Clause"
] | 33 | 2016-11-05T07:25:48.000Z | 2022-01-31T03:40:43.000Z | billy/tests/importers/test_utils.py | backwardn/billy | 07ac788d25a6c79d03dd0e3d55459bbb55e22439 | [
"BSD-3-Clause"
] | 16 | 2015-02-05T21:25:58.000Z | 2015-09-18T20:27:06.000Z | billy/tests/importers/test_utils.py | backwardn/billy | 07ac788d25a6c79d03dd0e3d55459bbb55e22439 | [
"BSD-3-Clause"
] | 22 | 2015-03-23T07:13:20.000Z | 2016-06-10T04:41:06.000Z | import re
import time
import datetime
from nose.tools import with_setup, assert_raises
from billy.core import db
from billy.importers import utils
def drop_everything():
db.metadata.drop()
db.legislators.drop()
db.bills.drop()
db.committees.drop()
def test_insert_with_id_duplicate_id():
obj = ... | 33.037234 | 79 | 0.603445 | import re
import time
import datetime
from nose.tools import with_setup, assert_raises
from billy.core import db
from billy.importers import utils
def drop_everything():
db.metadata.drop()
db.legislators.drop()
db.bills.drop()
db.committees.drop()
def test_insert_with_id_duplicate_id():
obj = ... | true | true |
1c353523dd72bb26442371df58b0ebb088eb80cd | 2,756 | py | Python | core/function.py | mc-nya/FedNest | 35405f4f9943488331eaada87bc9caf109ee6124 | [
"MIT"
] | null | null | null | core/function.py | mc-nya/FedNest | 35405f4f9943488331eaada87bc9caf109ee6124 | [
"MIT"
] | null | null | null | core/function.py | mc-nya/FedNest | 35405f4f9943488331eaada87bc9caf109ee6124 | [
"MIT"
] | 2 | 2022-02-23T10:46:28.000Z | 2022-02-24T16:19:50.000Z | from numpy import dtype
import torch.nn.functional as F
import torch
from torch.autograd import grad
def gather_flat_grad(loss_grad):
# convert the gradient output from list of tensors to to flat vector
return torch.cat([p.contiguous().view(-1) for p in loss_grad if not p is None])
def neumann_hyperstep_pr... | 37.243243 | 116 | 0.646589 | from numpy import dtype
import torch.nn.functional as F
import torch
from torch.autograd import grad
def gather_flat_grad(loss_grad):
return torch.cat([p.contiguous().view(-1) for p in loss_grad if not p is None])
def neumann_hyperstep_preconditioner(d_val_loss_d_theta, d_train_loss_d_w, elementary_lr, num... | true | true |
1c35359516695468349b188bdbe2a5db70c4134c | 670 | py | Python | ProductService/manage.py | surajkendhey/Kart | 458bee955d1569372fc8b3facb2602063a6ec6f5 | [
"Apache-2.0"
] | null | null | null | ProductService/manage.py | surajkendhey/Kart | 458bee955d1569372fc8b3facb2602063a6ec6f5 | [
"Apache-2.0"
] | null | null | null | ProductService/manage.py | surajkendhey/Kart | 458bee955d1569372fc8b3facb2602063a6ec6f5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ProductService.settings')
try:
from django.core.management import execute_from_command_line
exce... | 29.130435 | 78 | 0.68209 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ProductService.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and ... | true | true |
1c35364d7dc975462b487db0da5126d34f19d939 | 4,028 | py | Python | lib/surface/dataplex/lakes/create.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 2 | 2019-11-10T09:17:07.000Z | 2019-12-18T13:44:08.000Z | lib/surface/dataplex/lakes/create.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | null | null | null | lib/surface/dataplex/lakes/create.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 1 | 2020-07-25T01:40:19.000Z | 2020-07-25T01:40:19.000Z | # -*- coding: utf-8 -*- #
# Copyright 2021 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 39.490196 | 86 | 0.706554 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import lake
from googlecloudsdk.api_lib.dataplex import util as dataplex_util
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from goo... | true | true |
1c353653b40c7bfbb9044c05746afb39df3ff25f | 4,222 | py | Python | my_dlib/tsdlib.py | kiddkyd1412/find_av_by_face | e6071b9edbfb6a6ae1c833b13988b6262cc9aa55 | [
"Apache-2.0"
] | 4 | 2019-06-03T03:03:40.000Z | 2022-03-29T11:36:31.000Z | my_dlib/tsdlib.py | kiddkyd1412/find_av_by_face | e6071b9edbfb6a6ae1c833b13988b6262cc9aa55 | [
"Apache-2.0"
] | null | null | null | my_dlib/tsdlib.py | kiddkyd1412/find_av_by_face | e6071b9edbfb6a6ae1c833b13988b6262cc9aa55 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import base64
import json
import sys
import time
import warnings
from concurrent.futures import ThreadPoolExecutor, wait, as_completed
from operator import itemgetter
import dlib
import cv2
import os
import glob
import numpy as np
from iface import IFace
class FaceDlib(IFace):
def __ini... | 35.183333 | 120 | 0.623638 |
import base64
import json
import sys
import time
import warnings
from concurrent.futures import ThreadPoolExecutor, wait, as_completed
from operator import itemgetter
import dlib
import cv2
import os
import glob
import numpy as np
from iface import IFace
class FaceDlib(IFace):
def __init__(self):
supe... | true | true |
1c3536c1300674f74f83f7fe74d13104432a24e3 | 287 | py | Python | third_party_logistics/third_party_logistics/doctype/third_party_logistics_settings/third_party_logistics_settings.py | hafeesk/third_party_logistics | 6b97c5ad1bbb8386ca93e480bcb55ed3bc784ac4 | [
"MIT"
] | 1 | 2021-09-10T03:47:53.000Z | 2021-09-10T03:47:53.000Z | third_party_logistics/third_party_logistics/doctype/third_party_logistics_settings/third_party_logistics_settings.py | hafeesk/third_party_logistics | 6b97c5ad1bbb8386ca93e480bcb55ed3bc784ac4 | [
"MIT"
] | null | null | null | third_party_logistics/third_party_logistics/doctype/third_party_logistics_settings/third_party_logistics_settings.py | hafeesk/third_party_logistics | 6b97c5ad1bbb8386ca93e480bcb55ed3bc784ac4 | [
"MIT"
] | 1 | 2022-02-05T10:16:53.000Z | 2022-02-05T10:16:53.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2020, GreyCube Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class ThirdPartyLogisticsSettings(Document):
pass
| 26.090909 | 60 | 0.794425 |
from __future__ import unicode_literals
from frappe.model.document import Document
class ThirdPartyLogisticsSettings(Document):
pass
| true | true |
1c3536cd3198ab9694baf695fe2ae02d8f0eb8d2 | 5,751 | py | Python | Lista2.py | EnzoItaliano/calculoNumericoEmPython | be3161b823955620be71e0f94a3421288fd28ef0 | [
"MIT"
] | 1 | 2019-12-28T21:23:00.000Z | 2019-12-28T21:23:00.000Z | Lista2.py | EnzoItaliano/calculoNumericoEmPython | be3161b823955620be71e0f94a3421288fd28ef0 | [
"MIT"
] | null | null | null | Lista2.py | EnzoItaliano/calculoNumericoEmPython | be3161b823955620be71e0f94a3421288fd28ef0 | [
"MIT"
] | null | null | null | import math
import matplotlib.pyplot as plt
from prettytable import PrettyTable
from sympy import *
import numpy as np
x = symbols('x')
#Raízes de Equações
##Método da Bissecção
def plot2d(f, inicio, fim):
z = np.arange(inicio,fim,0.1)
y = []
for i in range(len(z)):
y.append(f.subs(x,z[i]))
... | 25.56 | 110 | 0.475569 | import math
import matplotlib.pyplot as plt
from prettytable import PrettyTable
from sympy import *
import numpy as np
x = symbols('x')
o, fim):
z = np.arange(inicio,fim,0.1)
y = []
for i in range(len(z)):
y.append(f.subs(x,z[i]))
fig, ax = plt.subplots()
ax.set(title='Gráfico fun... | true | true |
1c35398eb40634581f7229ddd5711a7b1ff8f982 | 442 | py | Python | mainapp/migrations/0046_rescuecamp_total_people.py | reyasmohammed/rescuekerala | 68ee6cd4ea7b94e04fd32c4d488bcd7a8f2d371c | [
"MIT"
] | 1 | 2021-12-09T17:59:01.000Z | 2021-12-09T17:59:01.000Z | mainapp/migrations/0046_rescuecamp_total_people.py | reyasmohammed/rescuekerala | 68ee6cd4ea7b94e04fd32c4d488bcd7a8f2d371c | [
"MIT"
] | 1 | 2018-08-28T13:26:26.000Z | 2018-08-28T13:26:26.000Z | mainapp/migrations/0046_rescuecamp_total_people.py | reyasmohammed/rescuekerala | 68ee6cd4ea7b94e04fd32c4d488bcd7a8f2d371c | [
"MIT"
] | 5 | 2019-11-07T11:34:56.000Z | 2019-11-07T11:36:00.000Z | # Generated by Django 2.1 on 2018-08-18 13:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0045_auto_20180818_1827'),
]
operations = [
migrations.AddField(
model_name='rescuecamp',
name='total_peopl... | 23.263158 | 100 | 0.626697 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0045_auto_20180818_1827'),
]
operations = [
migrations.AddField(
model_name='rescuecamp',
name='total_people',
field=models.IntegerField(bla... | true | true |
1c353a370d3284471c6a5674ae1c783f7f93b99a | 506 | py | Python | pylearn2/compat.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 2,045 | 2015-01-01T14:07:52.000Z | 2022-03-08T08:56:41.000Z | pylearn2/compat.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 305 | 2015-01-02T13:18:24.000Z | 2021-08-20T18:03:28.000Z | pylearn2/compat.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 976 | 2015-01-01T17:08:51.000Z | 2022-03-25T19:53:17.000Z | """
Compatibility layer
"""
from theano.compat import six
__all__ = ('OrderedDict', )
if six.PY3:
from collections import OrderedDict
else:
from theano.compat import OrderedDict
def first_key(obj):
""" Return the first key
Parameters
----------
obj: dict-like object
"""
return six... | 14.882353 | 41 | 0.624506 | from theano.compat import six
__all__ = ('OrderedDict', )
if six.PY3:
from collections import OrderedDict
else:
from theano.compat import OrderedDict
def first_key(obj):
return six.next(six.iterkeys(obj))
def first_value(obj):
return six.next(six.itervalues(obj))
| true | true |
1c353af5f765e844e7a94e9172e7f1021fcced24 | 7,706 | py | Python | Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py | jbathmann/ogs | a79e95d7521a841ffebd441a6100562847e03ab5 | [
"BSD-4-Clause"
] | null | null | null | Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py | jbathmann/ogs | a79e95d7521a841ffebd441a6100562847e03ab5 | [
"BSD-4-Clause"
] | 1 | 2021-09-02T14:21:33.000Z | 2021-09-02T14:21:33.000Z | Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py | jbathmann/ogs | a79e95d7521a841ffebd441a6100562847e03ab5 | [
"BSD-4-Clause"
] | null | null | null | ###
# Copyright(c) 2012 - 2019, OpenGeoSys Community(http://www.opengeosys.org)
# Distributed under a Modified BSD License.
# See accompanying file LICENSE.txt or
# http://www.opengeosys.org/project/license
###
import sys
print(sys.version)
import os
import numpy as np
from pandas import read_csv
import OpenGeoSys
fro... | 34.711712 | 79 | 0.600831 |
mport sys
print(sys.version)
import os
import numpy as np
from pandas import read_csv
import OpenGeoSys
from tespy import cmp, con, nwk, hlp, cmp_char
from tespy import nwkr
refrig_density = 992.92
switch_dyn_demand = 'on'
switch_dyn_frate = 'off'
def timerange(t):
timerange_nw_off_month = [-9999... | true | true |
1c353b4617bac86fc2666653def4885a80fa9857 | 3,115 | py | Python | django_optimizer/conf.py | robertxsuchocki/django-optimizer | 032a860285faaaab419ce06c5f015f32f85adb56 | [
"MIT"
] | null | null | null | django_optimizer/conf.py | robertxsuchocki/django-optimizer | 032a860285faaaab419ce06c5f015f32f85adb56 | [
"MIT"
] | null | null | null | django_optimizer/conf.py | robertxsuchocki/django-optimizer | 032a860285faaaab419ce06c5f015f32f85adb56 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Conf module containing app settings
"""
import os
import django
class DjangoOptimizerSettings(object):
"""
Container for settings exclusive for an app, with possibility to replace any in project settings
"""
def __getattribute__(self, item):
try:
return... | 39.935897 | 119 | 0.739647 |
import os
import django
class DjangoOptimizerSettings(object):
def __getattribute__(self, item):
try:
return getattr(django.conf.settings, item)
except AttributeError:
return super(DjangoOptimizerSettings, self).__getattribute__(item)
DJANGO_OPTIMIZER_FIELD_REGISTRY ... | true | true |
1c353b5ae4cc11c3f8e4c3d0a077e474e7b0bf43 | 2,385 | py | Python | assets/fonts/font.py | MilianoJunior/app_relatorios_EngeSEP | 9efb77a2e93f418f061c88f988a2c87971183708 | [
"MIT"
] | null | null | null | assets/fonts/font.py | MilianoJunior/app_relatorios_EngeSEP | 9efb77a2e93f418f061c88f988a2c87971183708 | [
"MIT"
] | null | null | null | assets/fonts/font.py | MilianoJunior/app_relatorios_EngeSEP | 9efb77a2e93f418f061c88f988a2c87971183708 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from controllers.excpetions.RootException import InterfaceException
def font_choice(name_font):
try:
const = -3
if name_font == None:
name_font = 'Roboto'
fonts = {'H1': [f'{name_font}Light', 96 + const, False, -1.5],
... | 54.204545 | 83 | 0.491405 |
import os
from controllers.excpetions.RootException import InterfaceException
def font_choice(name_font):
try:
const = -3
if name_font == None:
name_font = 'Roboto'
fonts = {'H1': [f'{name_font}Light', 96 + const, False, -1.5],
'H2': [f'{name_font}Light', 60 +... | true | true |
1c353d1e9561f6b6ea401312a6a5f248bfe40514 | 4,229 | py | Python | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Util/Padding.py | e11it/hue-1 | 436704c40b5fa6ffd30bd972bf50ffeec738d091 | [
"Apache-2.0"
] | 5,079 | 2015-01-01T03:39:46.000Z | 2022-03-31T07:38:22.000Z | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Util/Padding.py | e11it/hue-1 | 436704c40b5fa6ffd30bd972bf50ffeec738d091 | [
"Apache-2.0"
] | 1,623 | 2015-01-01T08:06:24.000Z | 2022-03-30T19:48:52.000Z | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Util/Padding.py | e11it/hue-1 | 436704c40b5fa6ffd30bd972bf50ffeec738d091 | [
"Apache-2.0"
] | 2,033 | 2015-01-04T07:18:02.000Z | 2022-03-28T19:55:47.000Z | #
# Util/Padding.py : Functions to manage padding
#
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | 39.523364 | 84 | 0.661386 |
__all__ = [ 'pad', 'unpad' ]
from Cryptodome.Util.py3compat import *
def pad(data_to_pad, block_size, style='pkcs7'):
padding_len = block_size-len(data_to_pad)%block_size
if style == 'pkcs7':
padding = bchr(padding_len)*padding_len
elif style == 'x923':
p... | true | true |
1c353d331a3c9af7cf0ecc5d525a68b4c13af975 | 1,945 | py | Python | cornac/models/global_avg/recom_global_avg.py | carmanzhang/cornac | 215efd0ffa7b8ee1afe1ac6b5cc650ee6303ace3 | [
"Apache-2.0"
] | 597 | 2018-07-17T10:59:56.000Z | 2022-03-31T07:59:36.000Z | cornac/models/global_avg/recom_global_avg.py | carmanzhang/cornac | 215efd0ffa7b8ee1afe1ac6b5cc650ee6303ace3 | [
"Apache-2.0"
] | 137 | 2018-10-12T10:52:11.000Z | 2022-03-04T15:26:49.000Z | cornac/models/global_avg/recom_global_avg.py | carmanzhang/cornac | 215efd0ffa7b8ee1afe1ac6b5cc650ee6303ace3 | [
"Apache-2.0"
] | 112 | 2018-07-26T04:36:34.000Z | 2022-03-31T02:29:34.000Z | # Copyright 2018 The Cornac 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 applicable ... | 34.122807 | 96 | 0.649357 |
import numpy as np
from ..recommender import Recommender
from ...exception import ScoreException
class GlobalAvg(Recommender):
def __init__(self, name="GlobalAvg"):
super().__init__(name=name, trainable=False)
def score(self, user_idx, item_idx=None):
if item_idx is None:
... | true | true |
1c353df540d3d1252e23a8ecdfe7323f5830e9b2 | 5,826 | py | Python | src/HindiTokenizer.py | amansinha09/HSDS | dd7cab75bd79a2cec1b9278215303b5e34e58e89 | [
"MIT"
] | 1 | 2021-07-04T08:54:20.000Z | 2021-07-04T08:54:20.000Z | Hindi-tokenization-stemming/HindiTokenizer.py | Piyush2912/Hindi-tokenization-stemmer | 87964d3a9e25a676817a6f09cf6d39586c93461e | [
"Apache-2.0"
] | null | null | null | Hindi-tokenization-stemming/HindiTokenizer.py | Piyush2912/Hindi-tokenization-stemmer | 87964d3a9e25a676817a6f09cf6d39586c93461e | [
"Apache-2.0"
] | 1 | 2018-11-17T09:12:31.000Z | 2018-11-17T09:12:31.000Z | # -*- coding: utf-8 -*-
import codecs
import re
class Tokenizer():
'''class for tokenizer'''
def __init__(self,text=None):
if text is not None:
self.text=text.decode('utf-8')
self.clean_text()
else:
self.text=None
self.sentences=[]
self.tokens=[]
self.stemmed_word=[]
self.final_list=[]
#self.... | 27.481132 | 413 | 0.570889 |
import codecs
import re
class Tokenizer():
'''class for tokenizer'''
def __init__(self,text=None):
if text is not None:
self.text=text.decode('utf-8')
self.clean_text()
else:
self.text=None
self.sentences=[]
self.tokens=[]
self.stemmed_word=[]
self.final_list=[]
def read_from_file(self,... | false | true |
1c353ed3b527f763ce3fa8788d6e55789d200524 | 712 | py | Python | rocknext/compliance/doctype/quality_feedback/quality_feedback.py | mohsinalimat/rocknext | ff04c00e9ea7d9089921f7b41447b83dc9d78501 | [
"MIT"
] | 8 | 2021-09-26T08:22:57.000Z | 2021-11-30T09:35:55.000Z | rocknext/compliance/doctype/quality_feedback/quality_feedback.py | yrestom/rocknext | 551b2443a3eafade07f7e254f14e336d0f54bd70 | [
"MIT"
] | null | null | null | rocknext/compliance/doctype/quality_feedback/quality_feedback.py | yrestom/rocknext | 551b2443a3eafade07f7e254f14e336d0f54bd70 | [
"MIT"
] | 9 | 2021-09-26T08:23:05.000Z | 2022-01-15T15:12:27.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ComplianceFeedback(Document):
@frappe.whitelist()
def set_parameters... | 27.384615 | 85 | 0.734551 |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ComplianceFeedback(Document):
@frappe.whitelist()
def set_parameters(self):
if self.template and not getattr(self, 'parameters', []):
for d in frappe.get_doc('Compliance Feedback Template', self.template... | true | true |
1c353f11b22a3afa0036fa7d5f43c1dd1bc8a9df | 7,451 | py | Python | model/vgg19/model19_val1.py | wan-h/JD-AI-Fashion-Challenge | 817f693672f418745e3a4c89a0417a3165b08130 | [
"MIT"
] | 3 | 2018-05-06T15:15:21.000Z | 2018-05-13T12:31:42.000Z | model/vgg19/model19_val1.py | wan-h/JD-AI-Fashion-Challenge | 817f693672f418745e3a4c89a0417a3165b08130 | [
"MIT"
] | null | null | null | model/vgg19/model19_val1.py | wan-h/JD-AI-Fashion-Challenge | 817f693672f418745e3a4c89a0417a3165b08130 | [
"MIT"
] | null | null | null | """
以model 4为基础,新增real crop
"""
import math
import os
import queue
import time
import keras
from keras.layers import Dense, BatchNormalization, Activation
import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig
model_config = KerasModelConfig(k_fold_file="1... | 51.034247 | 125 | 0.504899 | import math
import os
import queue
import time
import keras
from keras.layers import Dense, BatchNormalization, Activation
import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig
model_config = KerasModelConfig(k_fold_file="1.txt",
... | true | true |
1c353f5245e4b041683e3947627ee7976e474c94 | 17,653 | py | Python | tradingbot/components/broker/ig_interface.py | ajmal017/TradingBot-3 | 4a75562fb621d135d83b1770a3943fc9898adb66 | [
"MIT"
] | null | null | null | tradingbot/components/broker/ig_interface.py | ajmal017/TradingBot-3 | 4a75562fb621d135d83b1770a3943fc9898adb66 | [
"MIT"
] | 19 | 2021-11-03T12:19:06.000Z | 2022-03-30T12:28:29.000Z | tradingbot/components/broker/ig_interface.py | zacharyrgonzales/TradingBot | cb29c0cacc7ec655b79ad485492b265465068e84 | [
"MIT"
] | 1 | 2020-08-16T02:29:45.000Z | 2020-08-16T02:29:45.000Z | import json
import logging
from enum import Enum
from typing import Any, Dict, List, Optional
import pandas
import requests
from ...interfaces import Market, MarketHistory, MarketMACD, Position
from .. import Interval, TradeDirection, Utils
from . import AccountBalances, AccountInterface, StocksInterface
class IG_A... | 36.624481 | 88 | 0.562511 | import json
import logging
from enum import Enum
from typing import Any, Dict, List, Optional
import pandas
import requests
from ...interfaces import Market, MarketHistory, MarketMACD, Position
from .. import Interval, TradeDirection, Utils
from . import AccountBalances, AccountInterface, StocksInterface
class IG_A... | true | true |
1c353fccf7a39706f3f78621959aee8a1fa094d1 | 1,181 | py | Python | cern_access/indico_cern_access/models/access_request_regforms.py | ThiefMaster/indico-plugins-cern | 0082a66dd21ac093c1a31316d12c338f52ffe2d0 | [
"MIT"
] | 4 | 2019-02-12T05:08:56.000Z | 2022-03-09T23:43:18.000Z | cern_access/indico_cern_access/models/access_request_regforms.py | ThiefMaster/indico-plugins-cern | 0082a66dd21ac093c1a31316d12c338f52ffe2d0 | [
"MIT"
] | 40 | 2017-11-08T15:08:50.000Z | 2022-03-28T15:09:51.000Z | cern_access/indico_cern_access/models/access_request_regforms.py | ThiefMaster/indico-plugins-cern | 0082a66dd21ac093c1a31316d12c338f52ffe2d0 | [
"MIT"
] | 15 | 2017-11-08T12:35:59.000Z | 2022-01-13T15:16:42.000Z | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2021 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from sqlalchemy.ext.hybrid import hybrid_property
from indico.core... | 28.119048 | 76 | 0.703641 |
from sqlalchemy.ext.hybrid import hybrid_property
from indico.core.db.sqlalchemy import PyIntEnum, db
from indico_cern_access.models.access_requests import CERNAccessRequestState
class CERNAccessRequestRegForm(db.Model):
__tablename__ = 'access_request_regforms'
__table_args__ = {'schema': 'plugin_ce... | true | true |
1c353ffb374352e83aaa13aa425b716aa22909aa | 101 | py | Python | bike_app/constants.py | Himanshu372/Bike-pool-app | 937936e9a09a71224f74bfd25dd52a98df35f267 | [
"MIT"
] | 3 | 2021-02-18T17:06:09.000Z | 2021-09-17T07:52:58.000Z | bike_app/constants.py | Himanshu372/Bike_pool_app | 937936e9a09a71224f74bfd25dd52a98df35f267 | [
"MIT"
] | 10 | 2020-07-30T17:37:29.000Z | 2021-06-09T18:21:09.000Z | bike_app/constants.py | Himanshu372/Bike-pool-app | 937936e9a09a71224f74bfd25dd52a98df35f267 | [
"MIT"
] | 1 | 2020-05-03T13:00:01.000Z | 2020-05-03T13:00:01.000Z | MAPQUEST_URL = 'http://www.mapquestapi.com/geocoding/v1/address?key=SsRGOwY10OEkejYJYB2ACoaUiNtDDoIv' | 101 | 101 | 0.851485 | MAPQUEST_URL = 'http://www.mapquestapi.com/geocoding/v1/address?key=SsRGOwY10OEkejYJYB2ACoaUiNtDDoIv' | true | true |
1c3540843dbf08b1d3859f0070518a82ffe0a3c8 | 14,738 | py | Python | GAT_prediction.py | 897741007/EIAA | 94a071687eb387f199f9d8a82848a40ef2a6f5d7 | [
"Apache-2.0"
] | null | null | null | GAT_prediction.py | 897741007/EIAA | 94a071687eb387f199f9d8a82848a40ef2a6f5d7 | [
"Apache-2.0"
] | null | null | null | GAT_prediction.py | 897741007/EIAA | 94a071687eb387f199f9d8a82848a40ef2a6f5d7 | [
"Apache-2.0"
] | null | null | null | import torch
from torch import nn
import numpy as np
from Smi2Graph import SMI_grapher
from time import time
import os
class GAT_predictor(nn.Module):
def __init__(self, hidden_dim, layer_num, head_num, dict_size, dropout=0, bond_influence=0, prediction_class=2, device='cuda'):
# param : bond_influence -... | 48.640264 | 141 | 0.649003 | import torch
from torch import nn
import numpy as np
from Smi2Graph import SMI_grapher
from time import time
import os
class GAT_predictor(nn.Module):
def __init__(self, hidden_dim, layer_num, head_num, dict_size, dropout=0, bond_influence=0, prediction_class=2, device='cuda'):
... | true | true |
1c35411f49c68e3912b5bdc905b7cf0c05c5d8d1 | 12,490 | py | Python | differentiable_robot_model/spatial_vector_algebra.py | Neotriple/differentiable-robot-model | 7b3887b5d80ad7d99379962f9f46aabfd4a1c46d | [
"MIT"
] | null | null | null | differentiable_robot_model/spatial_vector_algebra.py | Neotriple/differentiable-robot-model | 7b3887b5d80ad7d99379962f9f46aabfd4a1c46d | [
"MIT"
] | null | null | null | differentiable_robot_model/spatial_vector_algebra.py | Neotriple/differentiable-robot-model | 7b3887b5d80ad7d99379962f9f46aabfd4a1c46d | [
"MIT"
] | null | null | null | from __future__ import annotations
import torch
import hydra
import math
from . import utils
from .utils import cross_product
def x_rot(angle):
if len(angle.shape) == 0:
angle = angle.unsqueeze(0)
angle = utils.convert_into_at_least_2d_pytorch_tensor(angle).squeeze(1)
batch_size = angle.shape[0]
... | 35.282486 | 110 | 0.569656 | from __future__ import annotations
import torch
import hydra
import math
from . import utils
from .utils import cross_product
def x_rot(angle):
if len(angle.shape) == 0:
angle = angle.unsqueeze(0)
angle = utils.convert_into_at_least_2d_pytorch_tensor(angle).squeeze(1)
batch_size = angle.shape[0]
... | true | true |
1c3543996fec7869a3dff75efacb00046a33f2f5 | 18,537 | py | Python | cryolo_relion_wrapper/cryolo_wrapper_library.py | Luger-Lab/Cryo-EM | 3eb62434181d6ce438190230758f6ce0e6b20af8 | [
"MIT"
] | 1 | 2020-12-23T20:14:16.000Z | 2020-12-23T20:14:16.000Z | cryolo_relion_wrapper/cryolo_wrapper_library.py | Luger-Lab/Cryo-EM | 3eb62434181d6ce438190230758f6ce0e6b20af8 | [
"MIT"
] | null | null | null | cryolo_relion_wrapper/cryolo_wrapper_library.py | Luger-Lab/Cryo-EM | 3eb62434181d6ce438190230758f6ce0e6b20af8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
'''
Original version written by Samuel Bowerman (6/22/2021)
'''
import os,sys,glob,datetime,itertools,subprocess,shutil
import numpy as np
def do_denoise(args,logfile):
starttime = datetime.datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
logfile.write("Beginning 'Denoise' task at "+startti... | 50.509537 | 281 | 0.68366 |
import os,sys,glob,datetime,itertools,subprocess,shutil
import numpy as np
def do_denoise(args,logfile):
starttime = datetime.datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
logfile.write("Beginning 'Denoise' task at "+starttime+"\n\n")
mics_star_path = args.in_mics
mics_star_file = open(mics_sta... | true | true |
1c354661a0b5ab8bc181ef7729f978760c4b1d9e | 192 | py | Python | tests/test_docser.py | chrisbrake/docser | 3421632f741f075c533db02757b5a778350589f9 | [
"BSD-3-Clause"
] | null | null | null | tests/test_docser.py | chrisbrake/docser | 3421632f741f075c533db02757b5a778350589f9 | [
"BSD-3-Clause"
] | null | null | null | tests/test_docser.py | chrisbrake/docser | 3421632f741f075c533db02757b5a778350589f9 | [
"BSD-3-Clause"
] | null | null | null | import pytest
@pytest.fixture()
def docser():
""" Get docser for testing """
import docser
return docser
def test_import(docser):
""" Test importable """
assert docser
| 13.714286 | 34 | 0.640625 | import pytest
@pytest.fixture()
def docser():
import docser
return docser
def test_import(docser):
assert docser
| true | true |
1c3546cd36759c7190de9c4a0c3e8fc967d1834f | 3,864 | py | Python | qiskit/extensions/quantum_initializer/ucy.py | tareqdandachi/qiskit-terra | 5221fe330adba5529bfa22dc25262ac8e6291aaf | [
"Apache-2.0"
] | 3 | 2019-05-19T17:39:38.000Z | 2020-01-28T19:59:18.000Z | qiskit/extensions/quantum_initializer/ucy.py | tareqdandachi/qiskit-terra | 5221fe330adba5529bfa22dc25262ac8e6291aaf | [
"Apache-2.0"
] | 4 | 2019-05-13T15:28:46.000Z | 2019-12-19T20:47:02.000Z | qiskit/extensions/quantum_initializer/ucy.py | tareqdandachi/qiskit-terra | 5221fe330adba5529bfa22dc25262ac8e6291aaf | [
"Apache-2.0"
] | 1 | 2021-07-07T16:55:41.000Z | 2021-07-07T16:55:41.000Z | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | 41.548387 | 93 | 0.689182 |
import math
from qiskit import QuantumRegister, QiskitError
from qiskit.circuit.quantumcircuit import QuantumCircuit
from qiskit.extensions.quantum_initializer.ucrot import UCRot
class UCY(UCRot):
def __init__(self, angle_list):
super().__init__(angle_list, "Y")
def ucy(self, angle_list,... | true | true |
1c3548998c612213f500cd3a9cd72c539e5ad7f3 | 358 | py | Python | smafer/model/base.py | IvanStrazov/smafer | cb7d9d61825aafc77ca05dc19e5fecb7d1632d16 | [
"MIT"
] | null | null | null | smafer/model/base.py | IvanStrazov/smafer | cb7d9d61825aafc77ca05dc19e5fecb7d1632d16 | [
"MIT"
] | null | null | null | smafer/model/base.py | IvanStrazov/smafer | cb7d9d61825aafc77ca05dc19e5fecb7d1632d16 | [
"MIT"
] | null | null | null | # utf-8
# Python 3.9
# 2021-05-03
from abc import abstractmethod, ABC
import pandas as pd
class __BaseModel(ABC):
@abstractmethod
def __init__(self, estimator, *args, **kwargs) -> None: pass
@abstractmethod
def fit(self, *args, **kwargs) -> pd.Series: pass
@abstractmethod
def predict(self... | 17.9 | 64 | 0.662011 |
from abc import abstractmethod, ABC
import pandas as pd
class __BaseModel(ABC):
@abstractmethod
def __init__(self, estimator, *args, **kwargs) -> None: pass
@abstractmethod
def fit(self, *args, **kwargs) -> pd.Series: pass
@abstractmethod
def predict(self, *args, **kwargs) -> pd.Series... | true | true |
1c354959b30f4bf8c734c6341435f0425bcbf8a1 | 1,024 | py | Python | app/app/urls.py | osamada/recipe-app-api | 9246e955392bd648539f20619b3039ea3d24b6d5 | [
"MIT"
] | null | null | null | app/app/urls.py | osamada/recipe-app-api | 9246e955392bd648539f20619b3039ea3d24b6d5 | [
"MIT"
] | null | null | null | app/app/urls.py | osamada/recipe-app-api | 9246e955392bd648539f20619b3039ea3d24b6d5 | [
"MIT"
] | null | null | null | """app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | 37.925926 | 77 | 0.709961 | from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('api/user/', include('user.urls')),
path('api/recipe/', include('recipe.urls')),
path('', include('hom... | true | true |
1c354a615dd5e8945e46ebed1cc944d5cf077255 | 18,002 | py | Python | supports/pyload/src/pyload/plugins/base/simple_downloader.py | LuckyNicky/pycrawler | 4b3fe2f6e8e51f236d95a64a89a44199e4e97743 | [
"Apache-2.0"
] | 1 | 2020-04-02T17:03:39.000Z | 2020-04-02T17:03:39.000Z | supports/pyload/src/pyload/plugins/base/simple_downloader.py | LuckyNicky/pycrawler | 4b3fe2f6e8e51f236d95a64a89a44199e4e97743 | [
"Apache-2.0"
] | null | null | null | supports/pyload/src/pyload/plugins/base/simple_downloader.py | LuckyNicky/pycrawler | 4b3fe2f6e8e51f236d95a64a89a44199e4e97743 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import re
from ...core.network.http.exceptions import BadHeader
from ...core.network.request_factory import get_url
from ...core.utils import parse
from ...core.utils.old import parse_name
from ..helpers import replace_patterns
from .downloader import BaseDownloader
class SimpleDow... | 35.160156 | 140 | 0.55205 |
import os
import re
from ...core.network.http.exceptions import BadHeader
from ...core.network.request_factory import get_url
from ...core.utils import parse
from ...core.utils.old import parse_name
from ..helpers import replace_patterns
from .downloader import BaseDownloader
class SimpleDownloader(BaseDownloader)... | true | true |
1c354aa3f18c72b34bc506ed91b7e96cfa3c03a4 | 41,250 | py | Python | tests/conftest.py | deniscapeto/SimpleCorreiosTrackingService | e96bcec580dc6cd2cc89c0e8e038270d40d19164 | [
"MIT"
] | null | null | null | tests/conftest.py | deniscapeto/SimpleCorreiosTrackingService | e96bcec580dc6cd2cc89c0e8e038270d40d19164 | [
"MIT"
] | 12 | 2020-06-05T23:26:54.000Z | 2021-10-02T09:36:41.000Z | tests/conftest.py | deniscapeto/SimpleCorreiosTrackingService | e96bcec580dc6cd2cc89c0e8e038270d40d19164 | [
"MIT"
] | 1 | 2019-10-11T00:32:06.000Z | 2019-10-11T00:32:06.000Z | import pytest
from scts.tracking.domain.models import TrackingEvent
@pytest.fixture
def fake_html():
return """
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1" />
<html lang="pt-br">
<head>
<meta ... | 52.347716 | 1,114 | 0.613939 | import pytest
from scts.tracking.domain.models import TrackingEvent
@pytest.fixture
def fake_html():
return """
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1" />
<html lang="pt-br">
<head>
<meta ... | true | true |
1c354b08bcf0fd5ba912adfd753b709ddd75dd45 | 21,566 | py | Python | tests/text_quotations_test.py | joelthe1/talon | 18de8bc35d8457a5ddfae1e52b9ee995422b4884 | [
"Apache-2.0"
] | null | null | null | tests/text_quotations_test.py | joelthe1/talon | 18de8bc35d8457a5ddfae1e52b9ee995422b4884 | [
"Apache-2.0"
] | null | null | null | tests/text_quotations_test.py | joelthe1/talon | 18de8bc35d8457a5ddfae1e52b9ee995422b4884 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from tests.fixtures import STANDARD_REPLIES
from talon import quotations
from six.moves import range
from nose.tools import eq_
from mock import patch
import email.iterators
import six
import os
@patch.object(quotations, 'MAX_LINES_COUNT', 1)
def test_t... | 25.135198 | 142 | 0.648011 |
from __future__ import absolute_import
from tests.fixtures import STANDARD_REPLIES
from talon import quotations
from six.moves import range
from nose.tools import eq_
from mock import patch
import email.iterators
import six
import os
@patch.object(quotations, 'MAX_LINES_COUNT', 1)
def test_too_many_lines():
ms... | true | true |
1c354b93e7aa0731074c6f491615d8409cc656ae | 3,151 | py | Python | axelrod/tests/strategies/test_darwin.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | axelrod/tests/strategies/test_darwin.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | axelrod/tests/strategies/test_darwin.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | """Tests for the Darwin PD strategy."""
import axelrod
from .test_player import TestPlayer
C, D = axelrod.Action.C, axelrod.Action.D
class TestDarwin(TestPlayer):
name = "Darwin"
player = axelrod.Darwin
expected_classifier = {
"memory_depth": float("inf"),
"stochastic": False,
... | 29.726415 | 86 | 0.579499 |
import axelrod
from .test_player import TestPlayer
C, D = axelrod.Action.C, axelrod.Action.D
class TestDarwin(TestPlayer):
name = "Darwin"
player = axelrod.Darwin
expected_classifier = {
"memory_depth": float("inf"),
"stochastic": False,
"makes_use_of": set(),
"long_run... | true | true |
1c354d8943d8ae1c961e81b29a5162cdf06ad82e | 12,600 | py | Python | vega/trainer/callbacks/timm_trainer_callback.py | jie311/vega | 1bba6100ead802697e691403b951e6652a99ccae | [
"MIT"
] | null | null | null | vega/trainer/callbacks/timm_trainer_callback.py | jie311/vega | 1bba6100ead802697e691403b951e6652a99ccae | [
"MIT"
] | null | null | null | vega/trainer/callbacks/timm_trainer_callback.py | jie311/vega | 1bba6100ead802697e691403b951e6652a99ccae | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | 38.650307 | 104 | 0.620794 |
import os
import importlib
import torch
from timm import create_model
from timm.optim.optim_factory import create_optimizer, add_weight_decay
from timm.scheduler import create_scheduler
from timm.data import Dataset, create_transform
from timm.utils import ModelEma
from timm.data.constants import IMAGENET_DE... | true | true |
1c354deb3b550e52959d47cde1cd5797407f7e48 | 394 | py | Python | .idea/para.py | alinaskukina/sql | 2600f29049a8e1613114db99f99f102677806ec8 | [
"MIT"
] | null | null | null | .idea/para.py | alinaskukina/sql | 2600f29049a8e1613114db99f99f102677806ec8 | [
"MIT"
] | null | null | null | .idea/para.py | alinaskukina/sql | 2600f29049a8e1613114db99f99f102677806ec8 | [
"MIT"
] | null | null | null | cursor.execute('create index salary_index on works (salary)')
con.commit()
# количество всех записей
ursor.execute('SELECT COUNT(*) FROM works')
print(cursor.fetchall()[0][0])
# men
cursor.execute('SELECT COUNT(*) FROM works where gender = "Мужской"')
print(cursor.fetchall()[0][0])
# women
cursor.execute('SELECT COU... | 28.142857 | 69 | 0.720812 | cursor.execute('create index salary_index on works (salary)')
con.commit()
ursor.execute('SELECT COUNT(*) FROM works')
print(cursor.fetchall()[0][0])
cursor.execute('SELECT COUNT(*) FROM works where gender = "Мужской"')
print(cursor.fetchall()[0][0])
cursor.execute('SELECT COUNT(*) FROM works where gender = "Женс... | true | true |
1c354f7b9aa064540b311d77ba59af35f5ca76da | 4,678 | py | Python | machine-learning-box/sentiment-analysis/predict_chainer.py | akito19/treasure-boxes | a70f69944ba40a2561c76fee3f27d47d9b8c68a7 | [
"MIT"
] | null | null | null | machine-learning-box/sentiment-analysis/predict_chainer.py | akito19/treasure-boxes | a70f69944ba40a2561c76fee3f27d47d9b8c68a7 | [
"MIT"
] | null | null | null | machine-learning-box/sentiment-analysis/predict_chainer.py | akito19/treasure-boxes | a70f69944ba40a2561c76fee3f27d47d9b8c68a7 | [
"MIT"
] | null | null | null | import json
import os
import sys
import tarfile
from logging import DEBUG, StreamHandler, getLogger
import numpy
os.system(f"{sys.executable} -m pip install -U pytd==0.8.0 td-client")
import pytd.pandas_td as td
os.system(f"{sys.executable} -m pip install -U chainer")
import chainer
from chainer_utils import nets,... | 28.876543 | 86 | 0.655622 | import json
import os
import sys
import tarfile
from logging import DEBUG, StreamHandler, getLogger
import numpy
os.system(f"{sys.executable} -m pip install -U pytd==0.8.0 td-client")
import pytd.pandas_td as td
os.system(f"{sys.executable} -m pip install -U chainer")
import chainer
from chainer_utils import nets,... | true | true |
1c354fd7ffeee53ea700310aab7c29b591e64050 | 6,100 | py | Python | docs/source/conf.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | 2 | 2020-09-30T04:59:06.000Z | 2021-03-30T20:42:44.000Z | docs/source/conf.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | null | null | null | docs/source/conf.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | 1 | 2018-05-25T07:15:16.000Z | 2018-05-25T07:15:16.000Z | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | 30.348259 | 79 | 0.643607 |
import os
import sys
from unittest.mock import MagicMock
sys.path.insert(0, os.path.abspath('./../../'))
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()
MOCK_MODULES = [
'numpy',
'tensorflow',
'tensorflow.python.platform',
'tensorflow... | true | true |
1c355016f0f9b2d0c9b718446060b9de55e60d0c | 5,385 | py | Python | compiler/testdata/expected/python.asyncio/variety/f_Events_publisher.py | chrisgustavsen-wf/frugal | 1140f5ff6a37b248e387d09a7779c7b25a4a92ee | [
"Apache-2.0"
] | null | null | null | compiler/testdata/expected/python.asyncio/variety/f_Events_publisher.py | chrisgustavsen-wf/frugal | 1140f5ff6a37b248e387d09a7779c7b25a4a92ee | [
"Apache-2.0"
] | null | null | null | compiler/testdata/expected/python.asyncio/variety/f_Events_publisher.py | chrisgustavsen-wf/frugal | 1140f5ff6a37b248e387d09a7779c7b25a4a92ee | [
"Apache-2.0"
] | null | null | null | #
# Autogenerated by Frugal Compiler (3.14.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
import inspect
import sys
import traceback
from thrift.Thrift import TApplicationException
from thrift.Thrift import TMessageType
from thrift.Thrift import TType
from frugal.exceptions import TApplic... | 33.240741 | 83 | 0.636769 |
import inspect
import sys
import traceback
from thrift.Thrift import TApplicationException
from thrift.Thrift import TMessageType
from thrift.Thrift import TType
from frugal.exceptions import TApplicationExceptionType
from frugal.middleware import Method
from frugal.subscription import FSubscription
from fruga... | true | true |
1c35517f1fb087b0522b5f6ab5e6f6c74382dc96 | 613 | py | Python | optimus/engines/dask/mask.py | niallscc/Optimus | 35218401556e5acc4beb2859084128ebcd1ab4e5 | [
"Apache-2.0"
] | null | null | null | optimus/engines/dask/mask.py | niallscc/Optimus | 35218401556e5acc4beb2859084128ebcd1ab4e5 | [
"Apache-2.0"
] | null | null | null | optimus/engines/dask/mask.py | niallscc/Optimus | 35218401556e5acc4beb2859084128ebcd1ab4e5 | [
"Apache-2.0"
] | null | null | null | from optimus.engines.base.commons.functions import is_string, is_integer, is_float, is_numeric
from optimus.engines.base.mask import Mask
class DaskMask(Mask):
def str(self, col_name="*"):
return self.root.cols.apply(col_name, is_string, mode="partitioned")
def int(self, col_name="*"):
retur... | 34.055556 | 94 | 0.706362 | from optimus.engines.base.commons.functions import is_string, is_integer, is_float, is_numeric
from optimus.engines.base.mask import Mask
class DaskMask(Mask):
def str(self, col_name="*"):
return self.root.cols.apply(col_name, is_string, mode="partitioned")
def int(self, col_name="*"):
retur... | true | true |
1c35519920b3991834ea4893aa056ce66a202318 | 9,077 | py | Python | orchestration/ci_helpers.py | danieldiamond/gitlab-analytics | f99e02c95c3a964b01cb14617a43cd5f64ecd88d | [
"MIT"
] | 3 | 2021-07-22T06:44:31.000Z | 2022-01-29T05:35:12.000Z | orchestration/ci_helpers.py | danieldiamond/gitlab-analytics | f99e02c95c3a964b01cb14617a43cd5f64ecd88d | [
"MIT"
] | null | null | null | orchestration/ci_helpers.py | danieldiamond/gitlab-analytics | f99e02c95c3a964b01cb14617a43cd5f64ecd88d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import pandas as pd
import sys
from atexit import register
from fire import Fire
from functools import partial
from logging import info, error, basicConfig
from os import environ as env, remove
from subprocess import run, PIPE, Popen, _active, _cleanup
from typing import Tuple
@register
def e... | 31.3 | 123 | 0.623334 |
import pandas as pd
import sys
from atexit import register
from fire import Fire
from functools import partial
from logging import info, error, basicConfig
from os import environ as env, remove
from subprocess import run, PIPE, Popen, _active, _cleanup
from typing import Tuple
@register
def exit_cleanup():
fo... | true | true |
1c3551b6915948fa8b32f6f08edf1841ec84fe43 | 1,511 | py | Python | snippet/templatetags/snippet.py | RealGeeks/django-snippet | 75f20e69902ba78bda6746b1ac7e8885fbfff698 | [
"MIT"
] | null | null | null | snippet/templatetags/snippet.py | RealGeeks/django-snippet | 75f20e69902ba78bda6746b1ac7e8885fbfff698 | [
"MIT"
] | null | null | null | snippet/templatetags/snippet.py | RealGeeks/django-snippet | 75f20e69902ba78bda6746b1ac7e8885fbfff698 | [
"MIT"
] | 1 | 2020-11-07T10:22:48.000Z | 2020-11-07T10:22:48.000Z | from django import template
from ..models import Snippet
register = template.Library()
default_snippet = {
"default": '"New Snippet"',
"safe": True,
}
class snippet_node(template.Node):
def __init__(self, name, default):
self.name = template.Variable(name)
self.default = default
def render(self, context)... | 23.246154 | 64 | 0.712111 | from django import template
from ..models import Snippet
register = template.Library()
default_snippet = {
"default": '"New Snippet"',
"safe": True,
}
class snippet_node(template.Node):
def __init__(self, name, default):
self.name = template.Variable(name)
self.default = default
def render(self, context)... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.