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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c0bd675fdf1eb643818ffcc4f8c903b05c13bcf | 3,772 | py | Python | state-change-localization-classification/slowFast-perceiver/tasks/video_task.py | EGO4D/hands-and-objects | 76d6ce6af1a9db4007ea24eb315f3f0eaea26bc2 | [
"MIT"
] | 24 | 2021-10-15T20:17:38.000Z | 2022-03-30T18:54:55.000Z | state-change-localization-classification/slowFast-perceiver/tasks/video_task.py | EGO4D/hands-and-objects | 76d6ce6af1a9db4007ea24eb315f3f0eaea26bc2 | [
"MIT"
] | 1 | 2022-03-09T03:35:42.000Z | 2022-03-10T20:50:24.000Z | state-change-localization-classification/slowFast-perceiver/tasks/video_task.py | EGO4D/hands-and-objects | 76d6ce6af1a9db4007ea24eb315f3f0eaea26bc2 | [
"MIT"
] | 4 | 2021-11-18T19:22:16.000Z | 2022-03-21T02:51:35.000Z | from pytorch_lightning.core import LightningModule
from sklearn.metrics import accuracy_score, average_precision_score
from torch.optim.lr_scheduler import LambdaLR, CosineAnnealingLR
import models.losses as losses
import optimizers.optimizer as optim
import utils.distributed as du
from datasets import loader
from mod... | 35.252336 | 89 | 0.65456 | from pytorch_lightning.core import LightningModule
from sklearn.metrics import accuracy_score, average_precision_score
from torch.optim.lr_scheduler import LambdaLR, CosineAnnealingLR
import models.losses as losses
import optimizers.optimizer as optim
import utils.distributed as du
from datasets import loader
from mod... | true | true |
1c0bd67c2db50591813fa9e63f194a583e4037f4 | 1,097 | py | Python | pyaofit/campaignfile.py | UlrichThomasGabor/aofit | 5b9093ce935d0da17fbb2d6185f62dadd69beb64 | [
"Unlicense"
] | null | null | null | pyaofit/campaignfile.py | UlrichThomasGabor/aofit | 5b9093ce935d0da17fbb2d6185f62dadd69beb64 | [
"Unlicense"
] | null | null | null | pyaofit/campaignfile.py | UlrichThomasGabor/aofit | 5b9093ce935d0da17fbb2d6185f62dadd69beb64 | [
"Unlicense"
] | null | null | null | import json
import os
import re
from pyaofit import *
class campaignfile(campaign):
@classmethod
def openFile(cls, campaign_filename):
with open(campaign_filename) as campaign_file:
campaign_dict = json.load(campaign_file)
campaign_name = os.path.splitext(os.path.basename(campaign_filename))[0]
campaign_pr... | 37.827586 | 112 | 0.776664 | import json
import os
import re
from pyaofit import *
class campaignfile(campaign):
@classmethod
def openFile(cls, campaign_filename):
with open(campaign_filename) as campaign_file:
campaign_dict = json.load(campaign_file)
campaign_name = os.path.splitext(os.path.basename(campaign_filename))[0]
campaign_pr... | true | true |
1c0bd6a2b7ff0e13650057cd6c83f0e92da19ddd | 30,248 | py | Python | spyder/plugins/completion/languageserver/plugin.py | alexgwf/spyder | e4912c04af12ad87118925c081bcb18ffc920c20 | [
"MIT"
] | 2 | 2020-12-13T04:57:52.000Z | 2021-02-23T03:30:31.000Z | spyder/plugins/completion/languageserver/plugin.py | ChicagoFJR/spyder | a3a35fd6ea769cdfc6b2308f8475bffe332914dc | [
"MIT"
] | 1 | 2015-07-27T20:15:43.000Z | 2015-07-27T21:00:15.000Z | spyder/plugins/completion/languageserver/plugin.py | ChicagoFJR/spyder | a3a35fd6ea769cdfc6b2308f8475bffe332914dc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Manager for all LSP clients connected to the servers defined
in our Preferences.
"""
# Standard library imports
import functools
import logging
import os
import ... | 38.929215 | 79 | 0.584336 |
import functools
import logging
import os
import os.path as osp
from qtpy.QtCore import Signal, Slot, QTimer
from qtpy.QtCore import Slot, QTimer
from qtpy.QtWidgets import QMessageBox
from spyder.config.base import (_, get_conf_path, running_under_pytest,
running_in_mac_app)
from sp... | true | true |
1c0bd70182a8f4ab6ad96d70ba7fe9abe30328b7 | 60,188 | py | Python | scripts/runExpr.py | lufovic77/DBx1000 | 268c6efb09059413395432cc89b8da0e39403f43 | [
"0BSD"
] | 10 | 2020-10-22T15:27:14.000Z | 2022-02-02T13:34:57.000Z | scripts/runExpr.py | JaySon-Huang/DBx1000 | 1c2c15e48ca3bb4ee0b58ac1c09945f463f61cc9 | [
"ISC"
] | null | null | null | scripts/runExpr.py | JaySon-Huang/DBx1000 | 1c2c15e48ca3bb4ee0b58ac1c09945f463f61cc9 | [
"ISC"
] | 6 | 2020-12-29T04:58:31.000Z | 2022-02-02T13:34:59.000Z | NUM_TRIALS = 4
import os.path
from os import path
import subprocess
from subprocess import TimeoutExpired
import re
import sys
import os
import datetime
import socket
from numpy.core.numeric import full
# from tools.logChecker import num
from numpy.core.shape_base import block
from scipy import optimize
filterFullSet... | 46.802488 | 661 | 0.606965 | NUM_TRIALS = 4
import os.path
from os import path
import subprocess
from subprocess import TimeoutExpired
import re
import sys
import os
import datetime
import socket
from numpy.core.numeric import full
from numpy.core.shape_base import block
from scipy import optimize
filterFullSet = [
'rundb_ND_YCSB_NOWAIT'... | true | true |
1c0bd78f3552b44a74afcf8722accf210de11e29 | 1,246 | py | Python | pbgpp/BGP/Open/Parameters/Capabilities/FQDN.py | antoine-blin/pbgp-parser | 592e26a9066e64cc11ec4812c050fcf5eeab2c3f | [
"Apache-2.0"
] | 73 | 2016-10-27T10:12:42.000Z | 2020-10-08T09:17:40.000Z | pbgpp/BGP/Open/Parameters/Capabilities/FQDN.py | antoine-blin/pbgp-parser | 592e26a9066e64cc11ec4812c050fcf5eeab2c3f | [
"Apache-2.0"
] | 26 | 2016-10-29T12:26:27.000Z | 2020-10-26T09:27:43.000Z | pbgpp/BGP/Open/Parameters/Capabilities/FQDN.py | antoine-blin/pbgp-parser | 592e26a9066e64cc11ec4812c050fcf5eeab2c3f | [
"Apache-2.0"
] | 18 | 2016-10-27T10:12:20.000Z | 2020-07-27T09:11:07.000Z | #
# This file is part of PCAP BGP Parser (pbgpp)
#
# Copyright 2016-2017 DE-CIX Management GmbH
# Author: Tobias Hannaske <tobias.hannaske@de-cix.net>
#
# 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 Lic... | 31.948718 | 74 | 0.724719 |
from pbgpp.BGP.Open.Parameters.Capability import BGPCapability
from pbgpp.BGP.Statics import BGPStatics
from pbgpp.BGP.Translation import BGPTranslation
class CapabilityFQDN(BGPCapability):
def __init__(self, payload):
BGPCapability.__init__(self, payload)
self.type = BGPStatics.CAPABILITY_FQDN
... | true | true |
1c0bd794e70101772d5d664ad27ba307d8561315 | 3,517 | py | Python | fboss/system_tests/testutils/port_utils.py | dhtech/fboss | f8c87a0d2855acdcf92e358bc900200cfa1a31bf | [
"BSD-3-Clause"
] | 1 | 2018-10-11T08:45:23.000Z | 2018-10-11T08:45:23.000Z | fboss/system_tests/testutils/port_utils.py | dhtech/fboss | f8c87a0d2855acdcf92e358bc900200cfa1a31bf | [
"BSD-3-Clause"
] | 2 | 2018-10-06T18:29:44.000Z | 2018-10-07T16:46:04.000Z | fboss/system_tests/testutils/port_utils.py | dhtech/fboss | f8c87a0d2855acdcf92e358bc900200cfa1a31bf | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
from fboss.system_tests.testutils.delayed_signals import DelayedSignalManager
import time
class DownAllPorts(DelayedSignalManager):
'''
Bring all of the ports down as a context manager and bring them
back up after we __exit__(). Build on top of DelayedSignalManager so
that if ... | 43.419753 | 81 | 0.627808 |
from fboss.system_tests.testutils.delayed_signals import DelayedSignalManager
import time
class DownAllPorts(DelayedSignalManager):
def __init__(self, test, retry=3):
self.test = test
self.downed_ports = []
self.retry = retry
super(DownAllPorts, self).__init__(test)
def __en... | true | true |
1c0bd81af9bcd2f8deb41199d1cf0f483bf2375d | 3,174 | py | Python | machine/corpora/scripture_text.py | sillsdev/machine.py | 61c0b29e706636a2353a1afc0b3ee372db7e632f | [
"MIT"
] | 2 | 2021-09-14T15:41:14.000Z | 2021-09-14T15:53:46.000Z | machine/corpora/scripture_text.py | sillsdev/machine.py | 61c0b29e706636a2353a1afc0b3ee372db7e632f | [
"MIT"
] | 2 | 2021-11-04T09:12:26.000Z | 2021-11-08T08:35:36.000Z | machine/corpora/scripture_text.py | sillsdev/machine.py | 61c0b29e706636a2353a1afc0b3ee372db7e632f | [
"MIT"
] | 1 | 2021-11-03T14:45:11.000Z | 2021-11-03T14:45:11.000Z | from abc import abstractmethod
from typing import Generator, List, Optional, Tuple
from ..scripture.verse_ref import VerseRef, Versification, VersificationType
from ..tokenization import Tokenizer
from ..utils.context_managed_generator import ContextManagedGenerator
from .corpora_helpers import get_scripture_text_sort... | 45.342857 | 117 | 0.664776 | from abc import abstractmethod
from typing import Generator, List, Optional, Tuple
from ..scripture.verse_ref import VerseRef, Versification, VersificationType
from ..tokenization import Tokenizer
from ..utils.context_managed_generator import ContextManagedGenerator
from .corpora_helpers import get_scripture_text_sort... | true | true |
1c0bd828bbeb122e1bcb82eec9dfeb3e61234b45 | 867 | py | Python | itchatmp/controllers/templatemsgs.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 1,504 | 2016-10-06T05:40:59.000Z | 2022-03-18T02:46:48.000Z | itchatmp/controllers/templatemsgs.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 51 | 2016-12-11T14:21:33.000Z | 2020-01-16T09:00:40.000Z | itchatmp/controllers/templatemsgs.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 370 | 2016-10-15T02:22:58.000Z | 2022-03-14T08:50:13.000Z | from .common import BaseController
from .mpapi.mp import templatemsgs as mpTMsg
class TemplateMsgs(BaseController):
def set_industry(self, id1, id2):
return self.determine_wrapper(mpTMsg.set_industry, None,
id1, id2)
def get_industry(self):
return self.determine_wrapper(mpTM... | 41.285714 | 69 | 0.694348 | from .common import BaseController
from .mpapi.mp import templatemsgs as mpTMsg
class TemplateMsgs(BaseController):
def set_industry(self, id1, id2):
return self.determine_wrapper(mpTMsg.set_industry, None,
id1, id2)
def get_industry(self):
return self.determine_wrapper(mpTM... | true | true |
1c0bd854abf15f90989fd22c3545e6ab53bbdc70 | 489 | py | Python | caer/adorad/types.py | lucasace/caer | e077a81e8d5bb3d38039ff9289a93996b1133411 | [
"MIT"
] | null | null | null | caer/adorad/types.py | lucasace/caer | e077a81e8d5bb3d38039ff9289a93996b1133411 | [
"MIT"
] | null | null | null | caer/adorad/types.py | lucasace/caer | e077a81e8d5bb3d38039ff9289a93996b1133411 | [
"MIT"
] | 1 | 2021-01-01T10:37:55.000Z | 2021-01-01T10:37:55.000Z | # _____ ______ _____
# / ____/ /\ | ____ | __ \
# | | / \ | |__ | |__) | Caer - Modern Computer Vision
# | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda
# | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer
# \_____\/_/ \_ \______ |_| \_\
# Lic... | 40.75 | 71 | 0.531697 | true | true | |
1c0bd94b9e90936fd253892e811381932d42874f | 467 | py | Python | env/lib/python3.8/site-packages/plotly/validators/layout/scene/zaxis/_visible.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | env/lib/python3.8/site-packages/plotly/validators/layout/scene/zaxis/_visible.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11 | 2020-08-09T02:30:14.000Z | 2022-03-12T00:50:14.000Z | env/lib/python3.8/site-packages/plotly/validators/layout/scene/zaxis/_visible.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11 | 2020-07-12T16:18:07.000Z | 2022-02-05T16:48:35.000Z | import _plotly_utils.basevalidators
class VisibleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="visible", parent_name="layout.scene.zaxis", **kwargs
):
super(VisibleValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | 31.133333 | 79 | 0.638116 | import _plotly_utils.basevalidators
class VisibleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="visible", parent_name="layout.scene.zaxis", **kwargs
):
super(VisibleValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | true | true |
1c0bdc4878fff6afd2cb32caa5b7271d20cc5893 | 18,807 | py | Python | axelrod/moran.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | axelrod/moran.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | axelrod/moran.py | dashiellfryer/Axelrod | 0d684b3273d15e3e0ecf70be8e893fffc5277c84 | [
"MIT"
] | null | null | null | """Implementation of the Moran process on Graphs."""
import random
from collections import Counter
from typing import Callable, List, Optional, Set, Tuple
import matplotlib.pyplot as plt
import numpy as np
from axelrod import EvolvablePlayer, DEFAULT_TURNS, Game, Player
from .deterministic_cache import Deterministic... | 34.699262 | 102 | 0.587388 |
import random
from collections import Counter
from typing import Callable, List, Optional, Set, Tuple
import matplotlib.pyplot as plt
import numpy as np
from axelrod import EvolvablePlayer, DEFAULT_TURNS, Game, Player
from .deterministic_cache import DeterministicCache
from .graph import Graph, complete_graph
from .... | true | true |
1c0bdc9b47d724f47c32fed88e3f82ae82c4e2f9 | 5,705 | py | Python | scripts/plot_roc.py | johntiger1/blog-posts | ef8b885c83fd41fb3ae82816f85a067c773d00ad | [
"MIT"
] | 51 | 2017-12-14T12:52:21.000Z | 2022-03-10T17:15:31.000Z | scripts/plot_roc.py | niceboy120/blog-posts | 0d67a598025abbef6dcf9a44fe3ef14c93d9d357 | [
"MIT"
] | 2 | 2018-12-30T12:16:06.000Z | 2020-12-03T03:43:58.000Z | scripts/plot_roc.py | niceboy120/blog-posts | 0d67a598025abbef6dcf9a44fe3ef14c93d9d357 | [
"MIT"
] | 76 | 2018-04-13T08:45:14.000Z | 2022-03-20T16:44:55.000Z | import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve
from sklearn.metrics import f1_score, roc_auc_score, precision_recall_curve, roc_curve
def plot_conf_matrix_and_roc(estimator, X, y, figure_size=(16, 6)):
"""
... | 38.033333 | 101 | 0.61227 | import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve
from sklearn.metrics import f1_score, roc_auc_score, precision_recall_curve, roc_curve
def plot_conf_matrix_and_roc(estimator, X, y, figure_size=(16, 6)):
fpr,... | true | true |
1c0bde8b3e3ddef82c7cab96bd26a9cc52c48e7a | 198 | py | Python | chapter3/todo_list/todo/controllers.py | qiujiajin/todo-list | 9d0dcc0d1f2b87dd497fec9afa81d592c7312041 | [
"MIT"
] | 11 | 2020-06-20T14:03:47.000Z | 2021-05-21T07:46:06.000Z | chapter3/todo_list/todo/controllers.py | qiujiajin/todo-list | 9d0dcc0d1f2b87dd497fec9afa81d592c7312041 | [
"MIT"
] | 2 | 2020-07-11T08:34:52.000Z | 2022-02-15T13:28:34.000Z | chapter3/todo_list/todo/controllers.py | qiujiajin/todo-list | 9d0dcc0d1f2b87dd497fec9afa81d592c7312041 | [
"MIT"
] | 10 | 2020-06-21T05:11:49.000Z | 2022-02-14T12:18:02.000Z | """
控制器
"""
from todo.utils import render_template
def index():
"""首页视图函数"""
return render_template('index.html')
routes = {
'/': (index, ['GET']),
'/index': (index, ['GET']),
}
| 12.375 | 40 | 0.545455 | from todo.utils import render_template
def index():
return render_template('index.html')
routes = {
'/': (index, ['GET']),
'/index': (index, ['GET']),
}
| true | true |
1c0bdf635ea261f3783c490a53a73db4f3be2545 | 10,421 | py | Python | examples/devel/webgui02.py | hryknkgw/pymolwin | 4a1335e90497dbcbfa789f1285a7c1ad84a051f8 | [
"CNRI-Python"
] | null | null | null | examples/devel/webgui02.py | hryknkgw/pymolwin | 4a1335e90497dbcbfa789f1285a7c1ad84a051f8 | [
"CNRI-Python"
] | null | null | null | examples/devel/webgui02.py | hryknkgw/pymolwin | 4a1335e90497dbcbfa789f1285a7c1ad84a051f8 | [
"CNRI-Python"
] | null | null | null | # Another simple example of how PyMOL can be controlled using a web browser
# using Python's built-in web server capabilities
import SocketServer
import BaseHTTPServer
import time
import cgi
import threading
import traceback
import os, sys, re
from pymol import cmd
from chempy.sdf import SDF
# example 3D sd file
i... | 29.190476 | 94 | 0.561462 |
import SocketServer
import BaseHTTPServer
import time
import cgi
import threading
import traceback
import os, sys, re
from pymol import cmd
from chempy.sdf import SDF
# example 3D sd file
input_sdf = os.environ['PYMOL_PATH']+"/test/dat/ligs3d.sdf"
class SafeDict(dict):
'''
we will need to synchronize acce... | false | true |
1c0be0a773c7b88dba8bebffe028d4dce6c49904 | 3,634 | py | Python | brainscoop/main.py | brainscoop/brainscoop-firestore-python | 25a1f4f18f2e60f8fb0846a1ec78490b1bea1b2d | [
"MIT"
] | null | null | null | brainscoop/main.py | brainscoop/brainscoop-firestore-python | 25a1f4f18f2e60f8fb0846a1ec78490b1bea1b2d | [
"MIT"
] | 2 | 2021-04-30T20:40:54.000Z | 2021-06-01T21:26:55.000Z | brainscoop/main.py | brainscoop/brainscoop-firestore-python | 25a1f4f18f2e60f8fb0846a1ec78490b1bea1b2d | [
"MIT"
] | null | null | null | import argparse
import command
import errno
import firebase_admin
import json
import logging
import os
import sys
from firebase_admin import credentials
from firebase_admin import firestore
class HelpFormatter(argparse.HelpFormatter):
def add_usage(self, usage, actions, groups, prefix=None):
prefix = 'Usa... | 31.877193 | 77 | 0.608145 | import argparse
import command
import errno
import firebase_admin
import json
import logging
import os
import sys
from firebase_admin import credentials
from firebase_admin import firestore
class HelpFormatter(argparse.HelpFormatter):
def add_usage(self, usage, actions, groups, prefix=None):
prefix = 'Usa... | false | true |
1c0be0b33b65503e06b76d1263f9956095705ff6 | 641 | py | Python | tpl/errors.py | faycheng/tpl | 2e2dceb9f5259101084d77c7279d0655097954a5 | [
"MIT"
] | null | null | null | tpl/errors.py | faycheng/tpl | 2e2dceb9f5259101084d77c7279d0655097954a5 | [
"MIT"
] | null | null | null | tpl/errors.py | faycheng/tpl | 2e2dceb9f5259101084d77c7279d0655097954a5 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
from gettext import gettext as _
class BaseError(BaseException):
ERR_MSG = _('')
class ShellExecError(BaseError):
ERR_MSG = _('Command exit code not zero. \nExit Code:\n{}.\nOut:\n{}\nErr:\n{}')
def __init__(self, exit_code, out, err):
self.message = self.ERR_MSG.format(... | 25.64 | 84 | 0.667707 |
from gettext import gettext as _
class BaseError(BaseException):
ERR_MSG = _('')
class ShellExecError(BaseError):
ERR_MSG = _('Command exit code not zero. \nExit Code:\n{}.\nOut:\n{}\nErr:\n{}')
def __init__(self, exit_code, out, err):
self.message = self.ERR_MSG.format(exit_code, out, err)
... | true | true |
1c0be16e6b5b3a4818c2d997408882b775cae559 | 4,692 | py | Python | src/oci/devops/models/create_devops_code_repository_trigger_details.py | CentroidChef/oci-python-sdk | fa406e27a52b40c70e220c20f52dfe2abe6236a3 | [
"Apache-2.0",
"BSD-3-Clause"
] | 249 | 2017-09-11T22:06:05.000Z | 2022-03-04T17:09:29.000Z | src/oci/devops/models/create_devops_code_repository_trigger_details.py | CentroidChef/oci-python-sdk | fa406e27a52b40c70e220c20f52dfe2abe6236a3 | [
"Apache-2.0",
"BSD-3-Clause"
] | 228 | 2017-09-11T23:07:26.000Z | 2022-03-23T10:58:50.000Z | src/oci/devops/models/create_devops_code_repository_trigger_details.py | CentroidChef/oci-python-sdk | fa406e27a52b40c70e220c20f52dfe2abe6236a3 | [
"Apache-2.0",
"BSD-3-Clause"
] | 224 | 2017-09-27T07:32:43.000Z | 2022-03-25T16:55:42.000Z | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 38.459016 | 245 | 0.676471 |
from .create_trigger_details import CreateTriggerDetails
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class CreateDevopsCodeRepositoryTriggerDetails(CreateTriggerDetails):
def _... | true | true |
1c0be18933d06b8879970a639d68be387fe28dbb | 9,340 | py | Python | twitch_log_renderer/__main__.py | Bloodb0ne/twitch_log_renderer | 39d812b5fe5fbbd61d19218636b9e335bd1725eb | [
"Apache-2.0"
] | 2 | 2020-10-11T03:23:37.000Z | 2020-11-13T18:58:58.000Z | twitch_log_renderer/__main__.py | Bloodb0ne/twitch_log_renderer | 39d812b5fe5fbbd61d19218636b9e335bd1725eb | [
"Apache-2.0"
] | 2 | 2021-01-30T08:59:09.000Z | 2021-06-26T18:04:57.000Z | twitch_log_renderer/__main__.py | Bloodb0ne/twitch_log_renderer | 39d812b5fe5fbbd61d19218636b9e335bd1725eb | [
"Apache-2.0"
] | null | null | null | import json
import datetime
import argparse
import os
import re
import numpy as np
import itertools
from .parsers import LogParser
from .rendering import HTMLRenderer, VideoRenderer,ImageRenderer
from .cachers import BadgeCache, CheermoteCache, Emote
from .providers import BTTV, FFZ, Twitch, User, Cheermotes, Badges
f... | 32.543554 | 140 | 0.736403 | import json
import datetime
import argparse
import os
import re
import numpy as np
import itertools
from .parsers import LogParser
from .rendering import HTMLRenderer, VideoRenderer,ImageRenderer
from .cachers import BadgeCache, CheermoteCache, Emote
from .providers import BTTV, FFZ, Twitch, User, Cheermotes, Badges
f... | true | true |
1c0be299a8644a9096ab528619fa83f148ce875f | 17,705 | py | Python | Tools/LyTestTools/ly_test_tools/environment/process_utils.py | pollend/o3de | 02b6b1dbf4d9889b55d4c11e049aa5b1804c9897 | [
"Apache-2.0",
"MIT"
] | null | null | null | Tools/LyTestTools/ly_test_tools/environment/process_utils.py | pollend/o3de | 02b6b1dbf4d9889b55d4c11e049aa5b1804c9897 | [
"Apache-2.0",
"MIT"
] | null | null | null | Tools/LyTestTools/ly_test_tools/environment/process_utils.py | pollend/o3de | 02b6b1dbf4d9889b55d4c11e049aa5b1804c9897 | [
"Apache-2.0",
"MIT"
] | null | null | null | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Process management functions, to supplement normal use of psutil and subprocess
"""
import logging
import os
import... | 37.831197 | 142 | 0.667269 | import logging
import os
import psutil
import subprocess
import ctypes
import ly_test_tools
import ly_test_tools.environment.waiter as waiter
logger = logging.getLogger(__name__)
_PROCESS_OUTPUT_ENCODING = 'utf-8'
LY_PROCESS_KILL_LIST = [
'CrySCompileServer', 'Editor',
'Profiler', 'RemoteConsole',
'rc' ... | true | true |
1c0be359224bab2163c8a652329873818e1a7d96 | 42 | py | Python | tests/__init__.py | shashank-m/decepticonlp | 40c101cbd96814c3389d0c1205570edefc9152b0 | [
"MIT"
] | 14 | 2020-05-04T22:25:48.000Z | 2021-03-06T03:22:27.000Z | tests/__init__.py | blackrosedragon2/decepticonlp | 8cb7762153d942555dbff3709d6dbfd12efc7dd3 | [
"MIT"
] | 74 | 2020-05-08T20:47:13.000Z | 2022-02-10T01:43:37.000Z | tests/__init__.py | blackrosedragon2/decepticonlp | 8cb7762153d942555dbff3709d6dbfd12efc7dd3 | [
"MIT"
] | 18 | 2020-05-04T22:46:24.000Z | 2020-07-05T15:29:35.000Z | """Unit test package for decepticonlp."""
| 21 | 41 | 0.714286 | true | true | |
1c0be4e6f91427eee95e2e8d108abcfba803f687 | 148 | py | Python | accounting/accounting/doctype/invoice_item/test_invoice_item.py | sumaiya2908/Accounting-App-Frappe | 48588b97f47ce76b0e7c0da153632ac8055efb84 | [
"MIT"
] | 1 | 2021-12-18T12:06:25.000Z | 2021-12-18T12:06:25.000Z | accounting/accounting/doctype/invoice_item/test_invoice_item.py | sumaiya2908/Accounting-App-Frappe | 48588b97f47ce76b0e7c0da153632ac8055efb84 | [
"MIT"
] | 5 | 2021-07-26T14:01:15.000Z | 2021-09-12T12:47:43.000Z | accounting/accounting/doctype/invoice_item/test_invoice_item.py | sumaiya2908/Accounting-App-Frappe | 48588b97f47ce76b0e7c0da153632ac8055efb84 | [
"MIT"
] | null | null | null | # Copyright (c) 2021, summayya and Contributors
# See license.txt
# import frappe
import unittest
class TestInvoiceItem(unittest.TestCase):
pass
| 16.444444 | 47 | 0.783784 |
import unittest
class TestInvoiceItem(unittest.TestCase):
pass
| true | true |
1c0be5d2f5f2d849d176ecd3dbb7aa6ed9c9dd5e | 1,329 | py | Python | src/prepare_dataset/dump_keys.py | floraxue/active-rl | db90c24dd70c3bbaa704e354f63ffaa6c2d7d851 | [
"MIT"
] | null | null | null | src/prepare_dataset/dump_keys.py | floraxue/active-rl | db90c24dd70c3bbaa704e354f63ffaa6c2d7d851 | [
"MIT"
] | null | null | null | src/prepare_dataset/dump_keys.py | floraxue/active-rl | db90c24dd70c3bbaa704e354f63ffaa6c2d7d851 | [
"MIT"
] | null | null | null | import os
from os.path import join
import pickle
pool_dir = '/data/active-rl-data/pool'
fixed_keys_path = join(pool_dir, 'cat_fixed_keys.p')
train_keys_path = join(pool_dir, 'cat_train_keys.p')
old_fixed_keys = pickle.load(open(fixed_keys_path, 'rb'))
# old_train_keys = pickle.load(open(train_keys_path, 'rb'))
new_... | 34.973684 | 92 | 0.714823 | import os
from os.path import join
import pickle
pool_dir = '/data/active-rl-data/pool'
fixed_keys_path = join(pool_dir, 'cat_fixed_keys.p')
train_keys_path = join(pool_dir, 'cat_train_keys.p')
old_fixed_keys = pickle.load(open(fixed_keys_path, 'rb'))
new_fixed_keys = []
new_train_keys = []
for i in range(12, 15)... | true | true |
1c0be5e3c09a170558b9d83179640dbde61bb625 | 6,566 | py | Python | datacoco_db/rdb_tools.py | equinoxfitness/datacoco.db | 43237afb412c8a382fbd66877c25f54f830a14f8 | [
"MIT"
] | 2 | 2020-01-10T22:06:04.000Z | 2020-03-19T17:53:16.000Z | datacoco_db/rdb_tools.py | equinoxfitness/datacoco.db | 43237afb412c8a382fbd66877c25f54f830a14f8 | [
"MIT"
] | 2 | 2020-01-22T09:38:14.000Z | 2020-03-11T09:19:32.000Z | datacoco_db/rdb_tools.py | equinoxfitness/datacoco-db | 43237afb412c8a382fbd66877c25f54f830a14f8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
DBInteraction
"""
import sqlalchemy
from sqlalchemy.sql import text
from sqlalchemy.dialects import registry
registry.register("mssql.pytds", "sqlalchemy_pytds.dialect", "MSDialect_pytds")
# iter from old datacoco also suggested for sqlalchemy
# sqlalchemy has a stream_results executio... | 30.398148 | 79 | 0.505787 |
import sqlalchemy
from sqlalchemy.sql import text
from sqlalchemy.dialects import registry
registry.register("mssql.pytds", "sqlalchemy_pytds.dialect", "MSDialect_pytds")
def _result_iter(cursor, arraysize):
while True:
results = cursor.fetchmany(arraysize)
if not results:
break
... | true | true |
1c0be6060f7b2fba182e6fe148b8950b8ba7cedf | 10,512 | py | Python | sdk/python/pulumi_azure_nextgen/network/v20171101/packet_capture.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_nextgen/network/v20171101/packet_capture.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_nextgen/network/v20171101/packet_capture.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 55.914894 | 2,248 | 0.694349 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['PacketCapture']
class PacketCapture(pulumi.CustomResource):
def __init__(__self__,
... | true | true |
1c0be686c7735e9f93574ec856536f23bd43b981 | 2,140 | py | Python | scripts/researchr_parse_amas.py | stephenfreund/PLDI-2021-Mini-Conf | 3d529d32a8563682ea69eb1e3b1742b447b71f42 | [
"MIT"
] | null | null | null | scripts/researchr_parse_amas.py | stephenfreund/PLDI-2021-Mini-Conf | 3d529d32a8563682ea69eb1e3b1742b447b71f42 | [
"MIT"
] | null | null | null | scripts/researchr_parse_amas.py | stephenfreund/PLDI-2021-Mini-Conf | 3d529d32a8563682ea69eb1e3b1742b447b71f42 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# usage: python3 researchr_parse_colocated_events_from_ics.py --room SOAP --ics workshop-researchr-example.ics --json pldi-researchr-full.json
import argparse
import json
import re
import requests
from ics.icalendar import Calendar
def parse_arguments():
parser = argparse.ArgumentParser(... | 27.088608 | 142 | 0.620093 |
import argparse
import json
import re
import requests
from ics.icalendar import Calendar
def parse_arguments():
parser = argparse.ArgumentParser(description="MiniConf Calendar Command Line")
parser.add_argument(
"--ics",
default="sample_cal.ics",
type=str,
help="ICS file to... | true | true |
1c0be7500e63c5e965124a5620515128f7150e82 | 2,538 | py | Python | recodoc2/apps/codebase/management/commands/linkall.py | bartdag/recodoc2 | 592c90fdd8e5bd8f9cbb3229771731294f4a1fba | [
"BSD-3-Clause"
] | 9 | 2015-06-16T01:20:02.000Z | 2022-01-16T02:36:59.000Z | recodoc2/apps/codebase/management/commands/linkall.py | xwyangjshb/recodoc2 | 592c90fdd8e5bd8f9cbb3229771731294f4a1fba | [
"BSD-3-Clause"
] | null | null | null | recodoc2/apps/codebase/management/commands/linkall.py | xwyangjshb/recodoc2 | 592c90fdd8e5bd8f9cbb3229771731294f4a1fba | [
"BSD-3-Clause"
] | 4 | 2019-10-20T10:10:34.000Z | 2022-01-16T02:36:51.000Z | from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from docutil.cache_util import clear_cache
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
from codebase.actions import link_code
class Command(NoArgs... | 39.65625 | 80 | 0.608353 | from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from docutil.cache_util import clear_cache
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
from codebase.actions import link_code
class Command(NoArgs... | true | true |
1c0be8763736e1c3252529084d0b80ecc2ae958e | 1,507 | py | Python | Projects/Online Workouts/w3resource/String/program-62.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 1 | 2019-09-23T15:51:45.000Z | 2019-09-23T15:51:45.000Z | Projects/Online Workouts/w3resource/String/program-62.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 5 | 2021-02-08T20:47:19.000Z | 2022-03-12T00:35:44.000Z | Projects/Online Workouts/w3resource/String/program-62.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
###########################################################################################
# #
# Program purpose: Compute sum of digits of a given string. #
# Program Aut... | 45.666667 | 98 | 0.442601 |
def obtain_user_data(input_mess: str) -> str:
is_valid, user_data = False, ''
while is_valid is False:
try:
user_data = input(input_mess)
if len(user_data) == 0:
raise ValueError('Please provide some string data to work with')
is_valid = True
... | true | true |
1c0be89d22b1292216e53a43eb168b6d53d4ba02 | 3,470 | py | Python | PublicKey/_DSA.py | BarryYBL/Cryptos | dcb118d49f3568ed6bbad9919e29c33ce03c2f95 | [
"Apache-2.0"
] | 1 | 2019-12-23T03:35:06.000Z | 2019-12-23T03:35:06.000Z | PublicKey/_DSA.py | BarryYBL/Cryptos | dcb118d49f3568ed6bbad9919e29c33ce03c2f95 | [
"Apache-2.0"
] | null | null | null | PublicKey/_DSA.py | BarryYBL/Cryptos | dcb118d49f3568ed6bbad9919e29c33ce03c2f95 | [
"Apache-2.0"
] | null | null | null |
#
# DSA.py : Digital Signature Algorithm
#
# Part of the Python Cryprography Toolkit
#
# Written by Andrew Kuchling, Paul Swartz, and others
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to th... | 29.913793 | 71 | 0.582997 |
__revision__ = "$Id$"
from Crypro.PublicKey.pubkey import *
from Crypro.Util import number
from Crypro.Util.number import bytes_to_long, long_to_bytes
from Crypro.Hash import SHA
from Crypro.Util.py3compat import *
class error (Exception):
pass
def generateQ(randfunc):
S=randfunc(20)
hash1=SHA.new(S).d... | true | true |
1c0be8d59a7faadbfe9529bba7851dad40f3c642 | 7,801 | py | Python | rowboat/models/guild.py | Lymia/rowboat | 391e1eab0323e4fc295404f367e62136265e9a60 | [
"MIT"
] | 6 | 2018-07-20T04:07:51.000Z | 2021-01-15T04:52:34.000Z | rowboat/models/guild.py | Lymia/rowboat | 391e1eab0323e4fc295404f367e62136265e9a60 | [
"MIT"
] | 1 | 2018-11-05T22:47:43.000Z | 2020-10-04T09:45:42.000Z | rowboat/models/guild.py | Lymia/rowboat | 391e1eab0323e4fc295404f367e62136265e9a60 | [
"MIT"
] | 6 | 2018-07-20T03:19:30.000Z | 2021-11-05T22:51:18.000Z | import yaml
import logging
from peewee import (
BigIntegerField, CharField, TextField, BooleanField, DateTimeField, CompositeKey, BlobField
)
from holster.enum import Enum
from datetime import datetime
from playhouse.postgres_ext import BinaryJSONField, ArrayField
from rowboat.sql import BaseModel
from rowboat.re... | 27.761566 | 104 | 0.60441 | import yaml
import logging
from peewee import (
BigIntegerField, CharField, TextField, BooleanField, DateTimeField, CompositeKey, BlobField
)
from holster.enum import Enum
from datetime import datetime
from playhouse.postgres_ext import BinaryJSONField, ArrayField
from rowboat.sql import BaseModel
from rowboat.re... | true | true |
1c0be91cf863c72c824030a14581d9be399a5b06 | 42,576 | py | Python | venv/Lib/site-packages/web/utils.py | alex-ber/ScrapyCourse | efdbc2f69d2f2815372c7548cc80992c8a41b235 | [
"BSD-2-Clause"
] | null | null | null | venv/Lib/site-packages/web/utils.py | alex-ber/ScrapyCourse | efdbc2f69d2f2815372c7548cc80992c8a41b235 | [
"BSD-2-Clause"
] | 1 | 2019-03-20T10:35:36.000Z | 2019-03-21T12:46:44.000Z | venv/Lib/site-packages/web/utils.py | alex-ber/RocketPaperScissorsGame | c38c82a17d508c892c686454864ee2356f441d1a | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
"""
General Utilities
(part of web.py)
"""
from __future__ import print_function
__all__ = [
"Storage", "storage", "storify",
"Counter", "counter",
"iters",
"rstrips", "lstrips", "strips",
"safeunicode", "safestr",
"timelimit",
"Memoize", "memoize",
"re_compile", "re_subm",
... | 27.900393 | 102 | 0.529406 | from __future__ import print_function
__all__ = [
"Storage", "storage", "storify",
"Counter", "counter",
"iters",
"rstrips", "lstrips", "strips",
"safeunicode", "safestr",
"timelimit",
"Memoize", "memoize",
"re_compile", "re_subm",
"group", "uniq", "iterview",
"IterBetter", "iterbetter",
"saf... | true | true |
1c0be97c7eb2d23956bde020ecce2ad61f3c7fc6 | 475 | py | Python | app/explorer/migrations/0002_challenge_action.py | LCOGT/serol | 1b1a0c8343fc7233b9935b8da64c90b8696134cc | [
"MIT"
] | null | null | null | app/explorer/migrations/0002_challenge_action.py | LCOGT/serol | 1b1a0c8343fc7233b9935b8da64c90b8696134cc | [
"MIT"
] | 19 | 2017-12-13T14:33:46.000Z | 2022-03-11T23:47:08.000Z | app/explorer/migrations/0002_challenge_action.py | LCOGT/serol | 1b1a0c8343fc7233b9935b8da64c90b8696134cc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-28 15:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('explorer', '0001_initial'),
]
operations = [
migrations.AddField(
... | 21.590909 | 48 | 0.6 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('explorer', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='challenge',
name='action',
field=m... | true | true |
1c0be9b140f69914b0fcbd4f930760a6bdd9ac1d | 3,114 | py | Python | Chapter01/mysite/mysite/settings.py | sabin-web/Django-3-by-Example | a0239c954d66fee190014fbd3fa975ddb6eeba17 | [
"MIT"
] | 628 | 2019-11-13T14:13:40.000Z | 2022-03-30T19:02:05.000Z | Chapter01/mysite/mysite/settings.py | HAKN1999/Django-3-by-Example | a0239c954d66fee190014fbd3fa975ddb6eeba17 | [
"MIT"
] | 96 | 2020-04-17T17:35:33.000Z | 2022-02-17T09:25:06.000Z | Chapter01/mysite/mysite/settings.py | HAKN1999/Django-3-by-Example | a0239c954d66fee190014fbd3fa975ddb6eeba17 | [
"MIT"
] | 782 | 2019-10-15T07:29:27.000Z | 2022-03-30T17:25:08.000Z | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 3.0.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Bu... | 25.52459 | 91 | 0.693963 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'n1_0c)#3!h(nzg1%4z94u2+yz@!fv@&l&v*-rwxk)+dr(v7(mn'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes... | true | true |
1c0be9d351fe70e4dcfc3b68235f847094e44e3e | 809 | py | Python | tests/test_op_swap.py | ruanton/qsim | 5cfe6fb5e20c85749490bf5c69921e9902fa2e75 | [
"MIT"
] | null | null | null | tests/test_op_swap.py | ruanton/qsim | 5cfe6fb5e20c85749490bf5c69921e9902fa2e75 | [
"MIT"
] | null | null | null | tests/test_op_swap.py | ruanton/qsim | 5cfe6fb5e20c85749490bf5c69921e9902fa2e75 | [
"MIT"
] | null | null | null | import numpy as np
from qsim import OperationSWAP, Circuit
def test_operation_swap():
c = Circuit(qubit_count=2)
o = OperationSWAP(c)
assert o.qubits_count == 2
op_matrix = np.array([
[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 1]])
assert np.array_equal(o.o... | 24.515152 | 58 | 0.574784 | import numpy as np
from qsim import OperationSWAP, Circuit
def test_operation_swap():
c = Circuit(qubit_count=2)
o = OperationSWAP(c)
assert o.qubits_count == 2
op_matrix = np.array([
[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 1]])
assert np.array_equal(o.o... | true | true |
1c0be9dc8d133412b08f0a2651849df39cd26354 | 77,044 | py | Python | tests/test_oic_provider.py | rectalogic/pyoidc | 5bdcb680e22afbf819e089e999746947215a7f26 | [
"Apache-2.0"
] | 1 | 2019-06-22T23:30:07.000Z | 2019-06-22T23:30:07.000Z | tests/test_oic_provider.py | peppelinux/pyoidc | 2e751ed84039259a2b138148eae204c877518950 | [
"Apache-2.0"
] | null | null | null | tests/test_oic_provider.py | peppelinux/pyoidc | 2e751ed84039259a2b138148eae204c877518950 | [
"Apache-2.0"
] | null | null | null | import datetime
import json
import logging
import os
from http.cookies import SimpleCookie
from time import time
from typing import Any # noqa
from typing import Dict # noqa
from typing import cast
from unittest.mock import Mock
from unittest.mock import patch
from urllib.parse import parse_qs
from urllib.parse impor... | 37.436346 | 102 | 0.610794 | import datetime
import json
import logging
import os
from http.cookies import SimpleCookie
from time import time
from typing import Any from typing import Dict from typing import cast
from unittest.mock import Mock
from unittest.mock import patch
from urllib.parse import parse_qs
from urllib.parse import urlencode
fr... | true | true |
1c0be9fc6aa97260622b1148763a57dbf25ce50f | 7,785 | py | Python | youtube_dl/extractor/turner.py | imnx/youtube-dl_rg3-src | e7bfe83e3a000b3cb37bf39a0ab5aaf9e08fc858 | [
"Unlicense"
] | 1 | 2017-09-15T02:40:25.000Z | 2017-09-15T02:40:25.000Z | youtube_dl/extractor/turner.py | imnx/youtube-dl_rg3-src | e7bfe83e3a000b3cb37bf39a0ab5aaf9e08fc858 | [
"Unlicense"
] | null | null | null | youtube_dl/extractor/turner.py | imnx/youtube-dl_rg3-src | e7bfe83e3a000b3cb37bf39a0ab5aaf9e08fc858 | [
"Unlicense"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..compat import compat_str
from ..utils import (
xpath_text,
int_or_none,
determine_ext,
parse_duration,
xpath_attr,
update_url_query,
ExtractorError,
)
class TurnerBaseIE(AdobePassI... | 43.25 | 140 | 0.487347 | from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..compat import compat_str
from ..utils import (
xpath_text,
int_or_none,
determine_ext,
parse_duration,
xpath_attr,
update_url_query,
ExtractorError,
)
class TurnerBaseIE(AdobePassIE):
def _ext... | true | true |
1c0bebaa7ff16321dc29c6a42e01b6b47b02eeab | 1,094 | py | Python | examples/reinforcement-learning/main_ddpg.py | verycumbersome/dynet | b477636c62e22efdaa024acf497080fc6a6dae1f | [
"Apache-2.0"
] | 3,307 | 2016-10-08T15:51:28.000Z | 2022-03-30T04:40:44.000Z | examples/reinforcement-learning/main_ddpg.py | verycumbersome/dynet | b477636c62e22efdaa024acf497080fc6a6dae1f | [
"Apache-2.0"
] | 1,348 | 2016-10-08T14:36:55.000Z | 2022-03-26T15:19:27.000Z | examples/reinforcement-learning/main_ddpg.py | verycumbersome/dynet | b477636c62e22efdaa024acf497080fc6a6dae1f | [
"Apache-2.0"
] | 741 | 2016-10-09T04:44:30.000Z | 2022-03-29T22:29:02.000Z | import argparse
import gym
from ddpg import DDPG
from train_test_utils import train_pipeline_conservative, test
def establish_args():
parser = argparse.ArgumentParser()
parser.add_argument("--env_name", default="Walker2d-v2", type=str)
parser.add_argument("--memory_size", default=1e6, type=float)
pars... | 40.518519 | 111 | 0.734918 | import argparse
import gym
from ddpg import DDPG
from train_test_utils import train_pipeline_conservative, test
def establish_args():
parser = argparse.ArgumentParser()
parser.add_argument("--env_name", default="Walker2d-v2", type=str)
parser.add_argument("--memory_size", default=1e6, type=float)
pars... | true | true |
1c0bebaf0966b16bf2e0c5b9f63faae78f847cbb | 3,247 | py | Python | pypureclient/flasharray/FA_2_10/models/policy_member_response.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 14 | 2018-12-07T18:30:27.000Z | 2022-02-22T09:12:33.000Z | pypureclient/flasharray/FA_2_10/models/policy_member_response.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 28 | 2019-09-17T21:03:52.000Z | 2022-03-29T22:07:35.000Z | pypureclient/flasharray/FA_2_10/models/policy_member_response.py | Flav-STOR-WL/py-pure-client | 03b889c997d90380ac5d6380ca5d5432792d3e89 | [
"BSD-2-Clause"
] | 15 | 2020-06-11T15:50:08.000Z | 2022-03-21T09:27:25.000Z | # coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.10
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from ... | 28.991071 | 139 | 0.554974 |
import pprint
import re
import six
import typing
from ....properties import Property
if typing.TYPE_CHECKING:
from pypureclient.flasharray.FA_2_10 import models
class PolicyMemberResponse(object):
swagger_types = {
'items': 'list[PolicyMember]'
}
attribute_map = {
'items': 'items'... | true | true |
1c0bebf21889865f1b43ed8442fefbe98bcf4568 | 1,358 | py | Python | 18/part2.py | jatowler/adventofcode-2015 | dc0d89f4292d37cb069746a57e016eb0c0cfb91f | [
"MIT"
] | 1 | 2015-12-22T10:42:27.000Z | 2015-12-22T10:42:27.000Z | 18/part2.py | jatowler/adventofcode-2015 | dc0d89f4292d37cb069746a57e016eb0c0cfb91f | [
"MIT"
] | null | null | null | 18/part2.py | jatowler/adventofcode-2015 | dc0d89f4292d37cb069746a57e016eb0c0cfb91f | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Solve AoC 2015 Day 18, Part 2"""
def count_neighbors(grid, i, j):
"""Count lit eight-connected neighbors.
Calculate all neighbors and check if they're already on
(i.e., in the grid)
"""
return sum(((x, y) in grid
for x in (i - 1, i, i + 1)
... | 23.016949 | 59 | 0.492636 | """Solve AoC 2015 Day 18, Part 2"""
def count_neighbors(grid, i, j):
"""Count lit eight-connected neighbors.
Calculate all neighbors and check if they're already on
(i.e., in the grid)
"""
return sum(((x, y) in grid
for x in (i - 1, i, i + 1)
for y in (j - 1, j, j ... | false | true |
1c0bec578aa7c69f31b8c6e0938e2c41d70ad0a1 | 2,112 | py | Python | consistency_checks.py | Joker-Jerome/consistency-checks | ca5c38de49017a33b55daedfb7a5896b91121fe9 | [
"MIT"
] | 1 | 2021-05-04T13:39:40.000Z | 2021-05-04T13:39:40.000Z | consistency_checks.py | Joker-Jerome/consistency-checks | ca5c38de49017a33b55daedfb7a5896b91121fe9 | [
"MIT"
] | null | null | null | consistency_checks.py | Joker-Jerome/consistency-checks | ca5c38de49017a33b55daedfb7a5896b91121fe9 | [
"MIT"
] | 2 | 2020-11-17T07:02:25.000Z | 2021-05-04T13:39:51.000Z | from enum import Enum
from config import db_engine, DBEngine
from utils import send_slack_notification
from db.mysql import execute_mysql_query
from db.postgresql import execute_pg_query
class RelationType(Enum):
EQUAL = 1
NOT_EQUAL = 2
SMALLER_THAN_OR_EQUAL = 3
def execute_query(query: str) -> float:
... | 32.492308 | 113 | 0.705492 | from enum import Enum
from config import db_engine, DBEngine
from utils import send_slack_notification
from db.mysql import execute_mysql_query
from db.postgresql import execute_pg_query
class RelationType(Enum):
EQUAL = 1
NOT_EQUAL = 2
SMALLER_THAN_OR_EQUAL = 3
def execute_query(query: str) -> float:
... | true | true |
1c0bf009da10398b8afb0381730192603bb44992 | 395 | py | Python | src/embedding/test_post.py | mykiscool/DeepCamera | e77cdbf45ab09895f315aa299bd6ac87b3bb6d66 | [
"MIT"
] | 914 | 2019-03-07T14:57:45.000Z | 2022-03-31T14:54:15.000Z | src/embedding/test_post.py | mykiscool/DeepCamera | e77cdbf45ab09895f315aa299bd6ac87b3bb6d66 | [
"MIT"
] | 45 | 2019-03-11T09:53:37.000Z | 2022-03-30T21:59:37.000Z | src/embedding/test_post.py | mykiscool/DeepCamera | e77cdbf45ab09895f315aa299bd6ac87b3bb6d66 | [
"MIT"
] | 148 | 2019-03-08T00:40:28.000Z | 2022-03-30T09:22:18.000Z | # -*- coding: UTF-8 -*-
import requests
import time
host = 'http://50.233.238.34:443'
# host = 'http://50.233.238.34:2988'
url = host + '/api/fullimg/'
payload = {'uuid': '7YRBBDB722205800', 'objid': '1'}
files = {'file': open('face_softmax/tmp_data/face_dataset/1_Bachan/01poster10.jpg', 'rb')}
res = requests.post... | 23.235294 | 90 | 0.681013 | import requests
import time
host = 'http://50.233.238.34:443'
url = host + '/api/fullimg/'
payload = {'uuid': '7YRBBDB722205800', 'objid': '1'}
files = {'file': open('face_softmax/tmp_data/face_dataset/1_Bachan/01poster10.jpg', 'rb')}
res = requests.post(url=url, params=payload, files=files)
print res.url
print r... | false | true |
1c0bf1f71a0f017dadcafc3ed02ea9fc224daff2 | 26,475 | py | Python | neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py | MatheMatrix/neutron | 5f50b972f9c31c4e558ed9486e742eacd8c115b7 | [
"Apache-2.0"
] | 1 | 2021-07-26T16:15:11.000Z | 2021-07-26T16:15:11.000Z | neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py | InfoHunter/neutron | 2acc53aa39b962640564b2c35252711995324eb7 | [
"Apache-2.0"
] | null | null | null | neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py | InfoHunter/neutron | 2acc53aa39b962640564b2c35252711995324eb7 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Radware 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
#
#... | 43.688119 | 79 | 0.47135 |
import re
import contextlib
import eventlet
import mock
from neutron import context
from neutron.extensions import loadbalancer
from neutron import manager
from neutron.openstack.common import jsonutils as json
from neutron.plugins.common import constants
from neutron.services.loadbalancer.drivers.radware import dri... | true | true |
1c0bf236cbd93d1990f9ec30b5049408c3c095d7 | 6,346 | py | Python | yolo/plugins.py | vansweej/tensorrt_demos | f3192204b2aa4f93e5271f499c605b7590d6099b | [
"MIT"
] | 1 | 2020-12-18T09:58:42.000Z | 2020-12-18T09:58:42.000Z | yolo/plugins.py | vansweej/tensorrt_demos | f3192204b2aa4f93e5271f499c605b7590d6099b | [
"MIT"
] | null | null | null | yolo/plugins.py | vansweej/tensorrt_demos | f3192204b2aa4f93e5271f499c605b7590d6099b | [
"MIT"
] | 1 | 2021-08-12T06:09:53.000Z | 2021-08-12T06:09:53.000Z | """plugins.py
I referenced the code from https://github.com/dongfangduoshou123/YoloV3-TensorRT/blob/master/seralizeEngineFromPythonAPI.py
"""
import ctypes
import numpy as np
import tensorrt as trt
try:
ctypes.cdll.LoadLibrary('../plugins/libyolo_layer.so')
except OSError as e:
raise SystemExit('ERROR: fai... | 42.02649 | 124 | 0.630791 |
import ctypes
import numpy as np
import tensorrt as trt
try:
ctypes.cdll.LoadLibrary('../plugins/libyolo_layer.so')
except OSError as e:
raise SystemExit('ERROR: failed to load ../plugins/libyolo_layer.so. '
'Did you forget to do a "make" in the "../plugins/" '
'su... | true | true |
1c0bf32d27bf964d97ac65a85187cc79ab166033 | 892 | py | Python | Task 14-15 - Wikidata properties categories/Wikipedia/create_p_category.py | maurusian/DarijaBot | e2e70378dd5e6645a97359b7495fc2bba6ab185d | [
"MIT"
] | null | null | null | Task 14-15 - Wikidata properties categories/Wikipedia/create_p_category.py | maurusian/DarijaBot | e2e70378dd5e6645a97359b7495fc2bba6ab185d | [
"MIT"
] | null | null | null | Task 14-15 - Wikidata properties categories/Wikipedia/create_p_category.py | maurusian/DarijaBot | e2e70378dd5e6645a97359b7495fc2bba6ab185d | [
"MIT"
] | null | null | null | import pywikibot
CAT_TITLE_PART = "تصنيف:پاجات كاتخدم خاصية ديال "
HIDDEN = "__HIDDENCAT__"
GENERAL_CAT = "تصنيف:پاجات كاتخدم خاصيات ديال ويكيداطا"
CREATE_SAVE_MESSAGE = "پاج د تّصنيف ديال خاصية د ويكيداطا تقادات"
ADD_CAT_SAVE_MESSAGE = "تصنيف ديال تّصنيفات تزاد"
site = pywikibot.Site()
with open('quarry-59138-un... | 26.235294 | 65 | 0.615471 | import pywikibot
CAT_TITLE_PART = "تصنيف:پاجات كاتخدم خاصية ديال "
HIDDEN = "__HIDDENCAT__"
GENERAL_CAT = "تصنيف:پاجات كاتخدم خاصيات ديال ويكيداطا"
CREATE_SAVE_MESSAGE = "پاج د تّصنيف ديال خاصية د ويكيداطا تقادات"
ADD_CAT_SAVE_MESSAGE = "تصنيف ديال تّصنيفات تزاد"
site = pywikibot.Site()
with open('quarry-59138-un... | true | true |
1c0bf444adc980c470f0ad2dcad0fb42e3d9796d | 509 | py | Python | ex041.py | dayellesouza/python-project | 202cf71274915672b88f6e44f0b65ee9dd3218e8 | [
"MIT"
] | 2 | 2021-02-10T21:28:26.000Z | 2021-08-18T19:52:28.000Z | ex041.py | dayellesouza/python-project | 202cf71274915672b88f6e44f0b65ee9dd3218e8 | [
"MIT"
] | null | null | null | ex041.py | dayellesouza/python-project | 202cf71274915672b88f6e44f0b65ee9dd3218e8 | [
"MIT"
] | null | null | null | from datetime import date
atual = date.today().year
nasc = int(input('Digite o ano de nascimento do aluno: '))
idade = atual - nasc
if idade <= 9:
print('Idade: {} \nCategoria: Mirim'.format(idade))
elif idade <= 14:
print('Idade: {} \nCategoria: Infantil'.format(idade))
elif idade <= 19:
print('... | 31.8125 | 59 | 0.640472 | from datetime import date
atual = date.today().year
nasc = int(input('Digite o ano de nascimento do aluno: '))
idade = atual - nasc
if idade <= 9:
print('Idade: {} \nCategoria: Mirim'.format(idade))
elif idade <= 14:
print('Idade: {} \nCategoria: Infantil'.format(idade))
elif idade <= 19:
print('... | true | true |
1c0bf592ba30ea9fd66f6b3d66425daa89827ba2 | 1,286 | py | Python | common/meta.py | nonemaw/YeTi | 92a3ba89f5b7fd8b2d5d3f5929ade0bf0b9e5cbe | [
"MIT"
] | 1 | 2017-10-04T12:21:20.000Z | 2017-10-04T12:21:20.000Z | common/meta.py | nonemaw/YeTi | 92a3ba89f5b7fd8b2d5d3f5929ade0bf0b9e5cbe | [
"MIT"
] | null | null | null | common/meta.py | nonemaw/YeTi | 92a3ba89f5b7fd8b2d5d3f5929ade0bf0b9e5cbe | [
"MIT"
] | null | null | null | from common.db import mongo_connect, MongoConfig
from common.crypto import AESCipher
from uni_parser.loader import ParserLoader
class Meta:
db = mongo_connect(MongoConfig.HOME.lower())
# `crypto` variable is an instance for AESCipher
crypto = None
# `parser` is an instance of ParserLoader
parser... | 27.361702 | 73 | 0.57154 | from common.db import mongo_connect, MongoConfig
from common.crypto import AESCipher
from uni_parser.loader import ParserLoader
class Meta:
db = mongo_connect(MongoConfig.HOME.lower())
crypto = None
parser = None
menu_fetcher = None
interface_fetcher = None
@staticmethod
de... | true | true |
1c0bf75f2d45820f209275f41dd2f633534f827e | 3,809 | py | Python | manilaclient/v2/access_groups.py | nidhimittalhada/manilaclient_for_access_group | 2d8dd4a962c125da131d277a0afbc842d442ff88 | [
"CNRI-Python",
"Apache-1.1"
] | null | null | null | manilaclient/v2/access_groups.py | nidhimittalhada/manilaclient_for_access_group | 2d8dd4a962c125da131d277a0afbc842d442ff88 | [
"CNRI-Python",
"Apache-1.1"
] | null | null | null | manilaclient/v2/access_groups.py | nidhimittalhada/manilaclient_for_access_group | 2d8dd4a962c125da131d277a0afbc842d442ff88 | [
"CNRI-Python",
"Apache-1.1"
] | null | null | null | # Copyright 2015 Wipro Technologies
# 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... | 34.627273 | 81 | 0.645576 | """Interface for access groups."""
from six.moves.urllib import parse
from manilaclient import api_versions
from manilaclient import base
from manilaclient.openstack.common.apiclient import base as common_base
RESOURCES_PATH = '/access_groups'
RESOURCE_PATH = '/access_groups/%s'
RESOURCE_PATH_ACTION = '/access_group... | false | true |
1c0bf791301497c94b71f9ed025078810cc7f6ee | 1,616 | py | Python | Module03/pregnancy_wheel.py | biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-pahelipatel97 | 5989c809402497967c97f1878ed0c72aa7c749f7 | [
"MIT"
] | null | null | null | Module03/pregnancy_wheel.py | biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-pahelipatel97 | 5989c809402497967c97f1878ed0c72aa7c749f7 | [
"MIT"
] | null | null | null | Module03/pregnancy_wheel.py | biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-pahelipatel97 | 5989c809402497967c97f1878ed0c72aa7c749f7 | [
"MIT"
] | null | null | null | import datetime
def print_header():
print('-----------------------------')
print(' PREGNANCY WHEEL')
print('-----------------------------')
print()
def get_LMP_from_user():
print("When was your last menstrual period (LMP)? ")
year = int(input("Year [YYYY]: "))
month = int(input("Mon... | 31.076923 | 140 | 0.669554 | import datetime
def print_header():
print('-----------------------------')
print(' PREGNANCY WHEEL')
print('-----------------------------')
print()
def get_LMP_from_user():
print("When was your last menstrual period (LMP)? ")
year = int(input("Year [YYYY]: "))
month = int(input("Mon... | true | true |
1c0bf7cf70676d0cf249d076f2a1540af54ed57e | 5,703 | py | Python | sphinxtheme/readability_theme_support.py | tokuda109/sphinxtheme-readability | fadf31d0b62a7a781f0a3a65a052d01bb2e0153a | [
"BSD-2-Clause"
] | 4 | 2015-06-09T20:14:19.000Z | 2016-11-13T23:32:40.000Z | sphinxtheme/readability_theme_support.py | tokuda109/sphinxtheme-readability | fadf31d0b62a7a781f0a3a65a052d01bb2e0153a | [
"BSD-2-Clause"
] | 2 | 2015-06-09T20:14:07.000Z | 2015-08-31T00:20:03.000Z | sphinxtheme/readability_theme_support.py | tokuda109/sphinxtheme-readability | fadf31d0b62a7a781f0a3a65a052d01bb2e0153a | [
"BSD-2-Clause"
] | 2 | 2015-06-14T10:44:44.000Z | 2015-08-24T18:21:18.000Z | # -*- coding: utf-8 -*-
"""
readability_theme_support
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by Tsuyoshi Tokuda.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import (Keyword, Name, Comment, String, Error,
Numb... | 54.314286 | 83 | 0.441873 |
from pygments.style import Style
from pygments.token import (Keyword, Name, Comment, String, Error,
Number, Operator, Generic, Whitespace,
Punctuation, Other, Literal)
class ReadabilityStyle(Style):
background_color = "#f8f8f8"
default_style = ""
st... | true | true |
1c0bf83228913ad73c1e5e8127bf57d57a68bbd3 | 2,324 | py | Python | util/tlgen/doc.py | ladmangesh805/opentitan | f4126a4a2eab29f6621aced2bcfd912149ebdf2d | [
"Apache-2.0"
] | 1 | 2019-12-24T02:10:12.000Z | 2019-12-24T02:10:12.000Z | util/tlgen/doc.py | BharathS11/opentitan | bfaf88058776f23428b317aad90ae93b822d6747 | [
"Apache-2.0"
] | null | null | null | util/tlgen/doc.py | BharathS11/opentitan | bfaf88058776f23428b317aad90ae93b822d6747 | [
"Apache-2.0"
] | null | null | null | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""TileLink-Uncached Lightweight Xbar self document
"""
import logging as log
from .validate import *
doc_intro = """
(start of output generated by `{}`)
The tables desc... | 24.463158 | 78 | 0.536575 | import logging as log
from .validate import *
doc_intro = """
(start of output generated by `{}`)
The tables describe each key and the type of the value. The following
types are used:
Type | Description
---- | -----------
"""
doc_tail = """
(end of output generated by `{}`)
"""
def print_control(control, head... | true | true |
1c0bf9e9e06351b3267cd7f8c8e81b13243d2842 | 2,406 | py | Python | codexbot/systemapps/systemcommands.py | itmaster921/codex.bot | aaa13cf72ac57b3899117c3e5fc94d0c33a0daa1 | [
"MIT"
] | 28 | 2015-12-19T23:43:07.000Z | 2022-03-03T05:37:30.000Z | codexbot/systemapps/systemcommands.py | itmaster921/codex.bot | aaa13cf72ac57b3899117c3e5fc94d0c33a0daa1 | [
"MIT"
] | 96 | 2015-12-18T16:49:24.000Z | 2022-01-20T12:04:36.000Z | codexbot/systemapps/systemcommands.py | itmaster921/codex.bot | aaa13cf72ac57b3899117c3e5fc94d0c33a0daa1 | [
"MIT"
] | 8 | 2018-03-29T07:03:09.000Z | 2022-03-31T10:48:42.000Z | import logging
class SystemCommand:
"""
Codex Bot system commands
"""
def __init__(self, api, core):
self.commands = {
'start': self.help,
'help': self.help,
'apps': self.apps
}
self.api = api
self.core = core
async def help(se... | 34.869565 | 141 | 0.556941 | import logging
class SystemCommand:
def __init__(self, api, core):
self.commands = {
'start': self.help,
'help': self.help,
'apps': self.apps
}
self.api = api
self.core = core
async def help(self, chat_hash, cmd_payload, bot_id):
... | true | true |
1c0bfa2481f5970529824e51d2ae339b8d3a9d4d | 5,059 | py | Python | data/iPER/extract_iPER.py | CJWBW/image2video-synthesis-using-cINNs | 30b19020d0c69f5ab66bf3e8259c3b6c84460a6f | [
"MIT"
] | 85 | 2021-03-30T07:21:05.000Z | 2022-03-30T02:47:01.000Z | data/iPER/extract_iPER.py | CJWBW/image2video-synthesis-using-cINNs | 30b19020d0c69f5ab66bf3e8259c3b6c84460a6f | [
"MIT"
] | 3 | 2021-09-28T13:09:52.000Z | 2022-02-18T12:38:48.000Z | data/iPER/extract_iPER.py | CJWBW/image2video-synthesis-using-cINNs | 30b19020d0c69f5ab66bf3e8259c3b6c84460a6f | [
"MIT"
] | 10 | 2021-05-20T11:43:20.000Z | 2022-01-11T15:31:31.000Z | import cv2
import argparse
from os import path, makedirs
import pickle
from tqdm import tqdm
# import imagesize
from glob import glob
from natsort import natsorted
def get_image(vidcap, frame_number,spatial_size=None):
vidcap.set(1, frame_number)
_, img = vidcap.read()
if spatial_size is not None and spati... | 30.847561 | 165 | 0.593793 | import cv2
import argparse
from os import path, makedirs
import pickle
from tqdm import tqdm
from glob import glob
from natsort import natsorted
def get_image(vidcap, frame_number,spatial_size=None):
vidcap.set(1, frame_number)
_, img = vidcap.read()
if spatial_size is not None and spatial_size != img.shap... | true | true |
1c0bfa982235d1f32764c0cfb05734d1a85b946f | 23,701 | py | Python | python/mxnet/optimizer.py | GrassSunFlower/mxnet_tmp | 190f16172cbe80f751d4840847fd5a5df43552bd | [
"Apache-2.0"
] | null | null | null | python/mxnet/optimizer.py | GrassSunFlower/mxnet_tmp | 190f16172cbe80f751d4840847fd5a5df43552bd | [
"Apache-2.0"
] | null | null | null | python/mxnet/optimizer.py | GrassSunFlower/mxnet_tmp | 190f16172cbe80f751d4840847fd5a5df43552bd | [
"Apache-2.0"
] | null | null | null | """Weight updating functions"""
import math
import pickle
import logging
from .ndarray import NDArray, zeros, clip, sqrt
from .ndarray import sgd_update, sgd_mom_update, adam_update, rmsprop_update, rmspropalex_update
from .random import normal
class Optimizer(object):
"""The base class inherited by all optimizer... | 33.714083 | 117 | 0.604785 | import math
import pickle
import logging
from .ndarray import NDArray, zeros, clip, sqrt
from .ndarray import sgd_update, sgd_mom_update, adam_update, rmsprop_update, rmspropalex_update
from .random import normal
class Optimizer(object):
def __init__(self, rescale_grad=1., param_idx2name=None, wd=0.,
... | true | true |
1c0bfb61e9746226844a0c0527edf5d9f392c0c6 | 4,782 | py | Python | madsenlab/axelrod/analysis/descriptive_stats.py | mmadsen/axelrod-ct | 90ea4319dd571546888c4d2a50255514e7d7fb94 | [
"Apache-2.0"
] | 5 | 2015-05-03T08:49:11.000Z | 2022-03-23T11:44:00.000Z | madsenlab/axelrod/analysis/descriptive_stats.py | mmadsen/axelrod-ct | 90ea4319dd571546888c4d2a50255514e7d7fb94 | [
"Apache-2.0"
] | null | null | null | madsenlab/axelrod/analysis/descriptive_stats.py | mmadsen/axelrod-ct | 90ea4319dd571546888c4d2a50255514e7d7fb94 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
Description here
"""
import logging as log
from collections import defaultdict
import numpy as np
import math ... | 29.158537 | 119 | 0.66353 |
import logging as log
from collections import defaultdict
import numpy as np
import math as m
import pprint as pp
def get_culture_count_map(pop):
counts = defaultdict(int)
graph = pop.agentgraph
for nodename in graph.nodes():
traits = graph.node[nodename]['traits']
culture = pop.get_trait... | true | true |
1c0bfc95e0f49b0f602283292c50241f38040223 | 12,170 | py | Python | kubernetes/client/models/v1_scale_io_persistent_volume_source.py | redjohn/python | 5e512ff564c244c50cab780d821542ed56aa965a | [
"Apache-2.0"
] | 1 | 2019-04-14T23:51:35.000Z | 2019-04-14T23:51:35.000Z | kubernetes/client/models/v1_scale_io_persistent_volume_source.py | redjohn/python | 5e512ff564c244c50cab780d821542ed56aa965a | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_scale_io_persistent_volume_source.py | redjohn/python | 5e512ff564c244c50cab780d821542ed56aa965a | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 31.858639 | 195 | 0.63221 |
from pprint import pformat
from six import iteritems
import re
class V1ScaleIOPersistentVolumeSource(object):
swagger_types = {
'fs_type': 'str',
'gateway': 'str',
'protection_domain': 'str',
'read_only': 'bool',
'secret_ref': 'V1SecretReference',
'ssl_enabled'... | true | true |
1c0bfda0d5002b8fe414cc399b6868239fde8b7e | 2,339 | py | Python | test/functional/feature_config_args.py | Polpette/compare-number435398 | 9099a2d43a69f8cb1f6894b8489b83a519a940a3 | [
"MIT"
] | null | null | null | test/functional/feature_config_args.py | Polpette/compare-number435398 | 9099a2d43a69f8cb1f6894b8489b83a519a940a3 | [
"MIT"
] | null | null | null | test/functional/feature_config_args.py | Polpette/compare-number435398 | 9099a2d43a69f8cb1f6894b8489b83a519a940a3 | [
"MIT"
] | 1 | 2019-12-21T21:36:08.000Z | 2019-12-21T21:36:08.000Z | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various command line arguments and configuration file parameters."""
import os
from test_framework.te... | 46.78 | 169 | 0.695596 |
import os
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import get_datadir_path
class ConfArgsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
def run_test(self):
self.stop_node(0)
... | true | true |
1c0bfe02c95c4cff195e2cabcf64f25e24b20f73 | 10,640 | py | Python | applications/structural_application/python_scripts/strategy_python_UL.py | jiaqiwang969/Kratos-test | ed082abc163e7b627f110a1ae1da465f52f48348 | [
"BSD-4-Clause"
] | null | null | null | applications/structural_application/python_scripts/strategy_python_UL.py | jiaqiwang969/Kratos-test | ed082abc163e7b627f110a1ae1da465f52f48348 | [
"BSD-4-Clause"
] | null | null | null | applications/structural_application/python_scripts/strategy_python_UL.py | jiaqiwang969/Kratos-test | ed082abc163e7b627f110a1ae1da465f52f48348 | [
"BSD-4-Clause"
] | null | null | null | #importing the Kratos Library
from Kratos import *
class SolvingStrategyPython:
#######################################################################
def __init__(self,gid_io,model_part,time_scheme,linear_solver,convergence_criteria,CalculateReactionsFlag,ReformDofSetAtEachStep,MoveMeshFlag):
#save ... | 41.5625 | 166 | 0.596617 | from Kratos import *
class SolvingStrategyPython:
def __init__(self,gid_io,model_part,time_scheme,linear_solver,convergence_criteria,CalculateReactionsFlag,ReformDofSetAtEachStep,MoveMeshFlag):
self.model_part = model_part
self.scheme = time_scheme
self.linear_solver = linear_s... | false | true |
1c0bffed7fecf2d297f0accb605a68c3a35356a8 | 6,093 | py | Python | code_for_mrc/optimization.py | QHZSS/SRAWL | 7862dea638f989f7ea34c1bcf404a654115c9ec7 | [
"Apache-2.0"
] | 1 | 2021-07-09T15:50:45.000Z | 2021-07-09T15:50:45.000Z | code_for_mrc/optimization.py | QHZSS/SRAWL | 7862dea638f989f7ea34c1bcf404a654115c9ec7 | [
"Apache-2.0"
] | null | null | null | code_for_mrc/optimization.py | QHZSS/SRAWL | 7862dea638f989f7ea34c1bcf404a654115c9ec7 | [
"Apache-2.0"
] | null | null | null |
"""PyTorch optimization for BERT model."""
import math
import torch
from torch.optim import Optimizer
from torch.nn.utils import clip_grad_norm_
def warmup_cosine(x, warmup=0.002):
if x < warmup:
return x/warmup
return 0.5 * (1.0 + torch.cos(math.pi * x))
def warmup_constant(x, warmup=0.002):
if... | 41.168919 | 116 | 0.557525 |
import math
import torch
from torch.optim import Optimizer
from torch.nn.utils import clip_grad_norm_
def warmup_cosine(x, warmup=0.002):
if x < warmup:
return x/warmup
return 0.5 * (1.0 + torch.cos(math.pi * x))
def warmup_constant(x, warmup=0.002):
if x < warmup:
return x/warmup
re... | true | true |
1c0c0123521ae754b092b8ebfdb3247bd9c9622c | 5,709 | py | Python | peyutil/input_output.py | OpenTreeOfLife/peyutil | 394661f01323f26688d32089472d7ac09f67e7d3 | [
"BSD-2-Clause"
] | null | null | null | peyutil/input_output.py | OpenTreeOfLife/peyutil | 394661f01323f26688d32089472d7ac09f67e7d3 | [
"BSD-2-Clause"
] | null | null | null | peyutil/input_output.py | OpenTreeOfLife/peyutil | 394661f01323f26688d32089472d7ac09f67e7d3 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
"""Simple utility functions for Input/Output."""
import codecs
import json
import stat
import sys
import os
from .str_util import is_str_type, StringIO
def open_for_group_write(fp, mode, encoding='utf-8'):
"""Open with mode=mode and permissions '-rw-rw-r--'.
Group writable is the defaul... | 33.582353 | 92 | 0.639517 | import codecs
import json
import stat
import sys
import os
from .str_util import is_str_type, StringIO
def open_for_group_write(fp, mode, encoding='utf-8'):
d = os.path.split(fp)[0]
if not os.path.exists(d):
os.makedirs(d)
o = codecs.open(fp, mode, encoding=encoding)
o.flush()
os.chmod(fp,... | true | true |
1c0c02d537e1702abe030d0430483dd4f473ed2a | 1,589 | py | Python | deeplearning/get_resnet_weights.py | wadpac/SleepStageClassification | 5b288995e62bbd66faa66bd932b06af8a65f8445 | [
"Apache-2.0"
] | 24 | 2019-04-15T09:18:51.000Z | 2022-03-05T14:09:34.000Z | deeplearning/get_resnet_weights.py | wadpac/SleepStageClassification | 5b288995e62bbd66faa66bd932b06af8a65f8445 | [
"Apache-2.0"
] | 2 | 2021-01-28T01:02:06.000Z | 2021-04-02T06:34:04.000Z | deeplearning/get_resnet_weights.py | wadpac/SleepStageClassification | 5b288995e62bbd66faa66bd932b06af8a65f8445 | [
"Apache-2.0"
] | 11 | 2019-05-30T19:27:39.000Z | 2021-06-19T02:41:53.000Z | import sys,os
import numpy as np
import tensorflow as tf
from tensorflow.keras import Input, Model
from tensorflow.keras.layers import Dense, Lambda, Dropout
import tensorflow.keras.backend as K
from tensorflow.keras.constraints import MaxNorm
from tensorflow.keras.initializers import glorot_uniform
from resnet import ... | 34.543478 | 73 | 0.708622 | import sys,os
import numpy as np
import tensorflow as tf
from tensorflow.keras import Input, Model
from tensorflow.keras.layers import Dense, Lambda, Dropout
import tensorflow.keras.backend as K
from tensorflow.keras.constraints import MaxNorm
from tensorflow.keras.initializers import glorot_uniform
from resnet import ... | true | true |
1c0c03304a13045ae033c2e7068867a547be9ee3 | 5,575 | py | Python | recording_utils/draw_utils.py | shijieS/OMOTDRecorder | 2e28c00d0ec682f4717a15a54da099085d6413b7 | [
"MIT"
] | 2 | 2020-07-04T13:50:03.000Z | 2020-12-12T03:50:27.000Z | recording_utils/draw_utils.py | shijieS/OMOTDRecorder | 2e28c00d0ec682f4717a15a54da099085d6413b7 | [
"MIT"
] | null | null | null | recording_utils/draw_utils.py | shijieS/OMOTDRecorder | 2e28c00d0ec682f4717a15a54da099085d6413b7 | [
"MIT"
] | 2 | 2020-09-05T06:58:02.000Z | 2021-08-09T11:36:36.000Z | # Copyright (c) 2019. ShiJie Sun at the Chang'an University
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Author: shijie Sun
# Email: shijieSun@chd.edu.cn
# Github: www.github.com/shijieS
import numpy as np
import cv2
def cut(d, small... | 35.062893 | 124 | 0.566457 | # This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Author: shijie Sun
# Email: shijieSun@chd.edu.cn
# Github: www.github.com/shijieS
import numpy as np
import cv2
def cut(d, small, great):
if d < small:
return small
if d > gr... | true | true |
1c0c045ddb46d69d5758023345eb73b9c300c063 | 484 | py | Python | python3/numpy/numpy.zeros_like.py | Nahid-Hassan/code-snippets | 24bd4b81564887822a0801a696001fcbeb6a7a75 | [
"MIT"
] | 2 | 2020-09-29T04:09:41.000Z | 2020-10-18T13:33:36.000Z | python3/numpy/numpy.zeros_like.py | Nahid-Hassan/code-snippets | 24bd4b81564887822a0801a696001fcbeb6a7a75 | [
"MIT"
] | null | null | null | python3/numpy/numpy.zeros_like.py | Nahid-Hassan/code-snippets | 24bd4b81564887822a0801a696001fcbeb6a7a75 | [
"MIT"
] | 1 | 2021-12-26T04:55:55.000Z | 2021-12-26T04:55:55.000Z | #numpy.zeros_like(a, dtype=None, order='K', subok=True)[source]
#Return an array of zeros with the same shape and type as a given array.
import numpy as np
x = np.arange(6)
x = x.reshape(2,3);
print("x = ",x)
print()
#output
#[[0 1 2]
#[3 4 5]]
x = np.zeros_like(x,order='A');
print("x = ",x)
print()
#output: with sa... | 16.133333 | 72 | 0.599174 |
import numpy as np
x = np.arange(6)
x = x.reshape(2,3);
print("x = ",x)
print()
x = np.zeros_like(x,order='A');
print("x = ",x)
print()
y = np.arange(3, dtype = float)
print("y = ",y)
print()
y = np.zeros_like(y)
print("y = ",y)
| true | true |
1c0c047c50954fe4352a9663e616ca69534384f5 | 6,784 | py | Python | iteracionunifac_A.py | DawffyddRiv/unifac_liq_vap | 1cab5d94e4e699f08c4fa270da51a2ac49d9d06d | [
"Apache-2.0"
] | null | null | null | iteracionunifac_A.py | DawffyddRiv/unifac_liq_vap | 1cab5d94e4e699f08c4fa270da51a2ac49d9d06d | [
"Apache-2.0"
] | null | null | null | iteracionunifac_A.py | DawffyddRiv/unifac_liq_vap | 1cab5d94e4e699f08c4fa270da51a2ac49d9d06d | [
"Apache-2.0"
] | null | null | null | import pandas as pd
import numpy
import time
print("Modelo UNIFAC by Dawffydd Riv")
print("""Este programa estima los coeficientes de actividad para el equilibrio liquido vapor
de los compuestos capturados en el archivo BBDDCompuestos """)
######################### Entrada de variables
#### <<<<<<<<<<<<<<<<<<<Entr... | 32.772947 | 119 | 0.693396 | import pandas as pd
import numpy
import time
print("Modelo UNIFAC by Dawffydd Riv")
print("""Este programa estima los coeficientes de actividad para el equilibrio liquido vapor
de los compuestos capturados en el archivo BBDDCompuestos """)
compuestos=pd.read_csv('BBDDCompuestos.csv')
print(compuestos.iloc[1:,0:1]... | true | true |
1c0c06921fb2b013602567d197cae030104184ef | 1,531 | bzl | Python | google/cloud/google_cloud_cpp_grpc_utils.bzl | sailakshmik/Bigtable | 63c0dea04c550aac33fbcedb6a933ec028bc65ca | [
"Apache-2.0"
] | null | null | null | google/cloud/google_cloud_cpp_grpc_utils.bzl | sailakshmik/Bigtable | 63c0dea04c550aac33fbcedb6a933ec028bc65ca | [
"Apache-2.0"
] | null | null | null | google/cloud/google_cloud_cpp_grpc_utils.bzl | sailakshmik/Bigtable | 63c0dea04c550aac33fbcedb6a933ec028bc65ca | [
"Apache-2.0"
] | 1 | 2021-12-09T16:26:23.000Z | 2021-12-09T16:26:23.000Z | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 34.022222 | 89 | 0.741346 |
google_cloud_cpp_grpc_utils_hdrs = [
"async_operation.h",
"background_threads.h",
"completion_queue.h",
"connection_options.h",
"grpc_error_delegate.h",
"grpc_utils/async_operation.h",
"grpc_utils/completion_queue.h",
"grpc_utils/grpc_error_delegate.h",
"grpc_utils/version.h",
... | true | true |
1c0c06f61635ec65e44c85c5559784e53e16176c | 2,232 | py | Python | app/models/request.py | ruganda/Archive1 | 62085e893b9ade3d6d872f9f0a675fd3c62bd543 | [
"MIT"
] | null | null | null | app/models/request.py | ruganda/Archive1 | 62085e893b9ade3d6d872f9f0a675fd3c62bd543 | [
"MIT"
] | 3 | 2018-06-02T12:51:08.000Z | 2018-06-02T14:34:13.000Z | app/models/request.py | ruganda/Maintenance_tracker | 62085e893b9ade3d6d872f9f0a675fd3c62bd543 | [
"MIT"
] | null | null | null | import uuid
class Request(object):
""" A class to handle actions related to requests"""
def __init__(self):
self.requests_list = []
def existing_request(self, description, item):
"""A method to check if the same request exists """
for request_object in self.requests_list:
... | 37.2 | 95 | 0.598566 | import uuid
class Request(object):
def __init__(self):
self.requests_list = []
def existing_request(self, description, item):
for request_object in self.requests_list:
if request_object['description'] == description and request_object['item'] == item:
return True
... | true | true |
1c0c0734dc661cacf96fdaf2a3da4c454e6c851b | 4,288 | py | Python | src/envs/pymarl_wrapper.py | umersheikh846/WQMIX | 3fbc088273c4ddb6876a352d18f057c50703546c | [
"Apache-1.1"
] | 4 | 2022-01-12T03:12:09.000Z | 2022-01-23T09:45:38.000Z | src/envs/pymarl_wrapper.py | umersheikh846/WQMIX | 3fbc088273c4ddb6876a352d18f057c50703546c | [
"Apache-1.1"
] | null | null | null | src/envs/pymarl_wrapper.py | umersheikh846/WQMIX | 3fbc088273c4ddb6876a352d18f057c50703546c | [
"Apache-1.1"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
from .multiagentenv import MultiAgentEnv
class Environment(MultiAgentEnv):
def __init__(self, env_name='matthew', seed=None):
self._seed = seed
self.normalize = True
self.resource_type = 'all'
self.obs3neighbors = True
sel... | 31.762963 | 83 | 0.580457 | import numpy as np
import matplotlib.pyplot as plt
from .multiagentenv import MultiAgentEnv
class Environment(MultiAgentEnv):
def __init__(self, env_name='matthew', seed=None):
self._seed = seed
self.normalize = True
self.resource_type = 'all'
self.obs3neighbors = True
sel... | true | true |
1c0c07f1d8ada418a54636edfdbedcd13b6419c3 | 7,610 | py | Python | fontforge_helper/multidialog.py | skef/fontforge_helper | 6b4e3ed0bec72472ae722010df8453c4e904887d | [
"MIT"
] | null | null | null | fontforge_helper/multidialog.py | skef/fontforge_helper | 6b4e3ed0bec72472ae722010df8453c4e904887d | [
"MIT"
] | null | null | null | fontforge_helper/multidialog.py | skef/fontforge_helper | 6b4e3ed0bec72472ae722010df8453c4e904887d | [
"MIT"
] | null | null | null | from collections.abc import Hashable
from enum import Enum
import abc
from copy import deepcopy
class MultiAnswer(dict):
@property
def default(self):
return super().get('default', False)
@default.setter
def default(self, v):
if v:
super().__setitem__('default', True)
... | 29.382239 | 135 | 0.584231 | from collections.abc import Hashable
from enum import Enum
import abc
from copy import deepcopy
class MultiAnswer(dict):
@property
def default(self):
return super().get('default', False)
@default.setter
def default(self, v):
if v:
super().__setitem__('default', True)
... | true | true |
1c0c08584fe136257e867c45e6e76230d38058cb | 5,607 | py | Python | Dropout_Prediction/feature_selector.py | Yixin-Cheng/8755Project | 6612b606e185bf27d020726817a13f12fa9dd680 | [
"MIT"
] | null | null | null | Dropout_Prediction/feature_selector.py | Yixin-Cheng/8755Project | 6612b606e185bf27d020726817a13f12fa9dd680 | [
"MIT"
] | null | null | null | Dropout_Prediction/feature_selector.py | Yixin-Cheng/8755Project | 6612b606e185bf27d020726817a13f12fa9dd680 | [
"MIT"
] | null | null | null | """
This file is for the feature selection based on Genetic Algorithm and SVM
"""
# import required libraries
import numpy as np
from sklearn.svm import SVC
import pandas as pd
from sklearn.model_selection import train_test_split, cross_validate
# ## Step 2: Define settings
# 1. DNA size: the number of bits in DNA
# ... | 40.05 | 133 | 0.580346 | import numpy as np
from sklearn.svm import SVC
import pandas as pd
from sklearn.model_selection import train_test_split, cross_validate
class Selector:
def __init__(self,path,target_path):
self.target_path=target_path
self.path=path
self.df=pd.read_csv(self.path)
self.DNA_SIZE ... | true | true |
1c0c08bc2f1b46afd0610b8174d757dce4a3ef43 | 1,570 | py | Python | src/applications/blog/views.py | varlog762/tms-d | 4dd13bdd1522a35cf4e05e17cd13e06ba01a2f96 | [
"MIT"
] | null | null | null | src/applications/blog/views.py | varlog762/tms-d | 4dd13bdd1522a35cf4e05e17cd13e06ba01a2f96 | [
"MIT"
] | null | null | null | src/applications/blog/views.py | varlog762/tms-d | 4dd13bdd1522a35cf4e05e17cd13e06ba01a2f96 | [
"MIT"
] | null | null | null | from typing import Dict
from django import forms
from django.urls import reverse_lazy
from django.views.generic import CreateView
from django.views.generic import DeleteView
from django.views.generic import DetailView
from django.views.generic import ListView
from django.views.generic import RedirectView
from django.v... | 24.53125 | 78 | 0.710191 | from typing import Dict
from django import forms
from django.urls import reverse_lazy
from django.views.generic import CreateView
from django.views.generic import DeleteView
from django.views.generic import DetailView
from django.views.generic import ListView
from django.views.generic import RedirectView
from django.v... | true | true |
1c0c0936f4f8b1ff405274d577742c4584eababd | 10,234 | py | Python | test/get_previous_releases.py | wilofice/dahomey | 5cbc2406a27e68bbe30f85a7162b86f4741effab | [
"MIT"
] | 1 | 2022-03-19T13:35:37.000Z | 2022-03-19T13:35:37.000Z | test/get_previous_releases.py | wilofice/danxome | 5cbc2406a27e68bbe30f85a7162b86f4741effab | [
"MIT"
] | null | null | null | test/get_previous_releases.py | wilofice/danxome | 5cbc2406a27e68bbe30f85a7162b86f4741effab | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#
# Copyright (c) 2018-2021 The Danxome Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Download or build previous releases.
# Needs curl and tar to download a release, or the build depend... | 42.115226 | 116 | 0.663084 |
import argparse
import contextlib
from fnmatch import fnmatch
import os
from pathlib import Path
import re
import shutil
import subprocess
import sys
import hashlib
SHA256_SUMS = {
"d40f18b4e43c6e6370ef7db9131f584fbb137276ec2e3dba67a4b267f81cb644": "danxome-0.15.2-aarch64-linux-gnu.tar.gz",
"54fb877a148a6ad1... | true | true |
1c0c0c3f7e913bd4a415736c3ca30e683f5b7b2f | 1,554 | py | Python | accounts/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | 1 | 2020-05-06T16:59:47.000Z | 2020-05-06T16:59:47.000Z | accounts/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | null | null | null | accounts/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-21 12:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.... | 43.166667 | 171 | 0.625483 | from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | true | true |
1c0c0c77e75f1d0530c06ac4131289261d7f06b4 | 341 | py | Python | frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:55:29.000Z | 2021-04-29T14:55:29.000Z | frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | 1 | 2021-04-29T14:39:01.000Z | 2021-04-29T14:39:01.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Sales Taxes and Charges Template')
class TestSalesTaxesandChargesTemplate(unitt... | 26.230769 | 85 | 0.797654 | from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Sales Taxes and Charges Template')
class TestSalesTaxesandChargesTemplate(unittest.TestCase):
pass
| true | true |
1c0c0c7d0f9334b51a79458922a803eeb991d3a6 | 337 | py | Python | pysimu/ssa.py | pysimu/pysimu | 646432bc96be199165b112a77b5ff650b97152ba | [
"MIT"
] | 1 | 2019-09-04T12:01:48.000Z | 2019-09-04T12:01:48.000Z | pysimu/ssa.py | pysimu/pysimu | 646432bc96be199165b112a77b5ff650b97152ba | [
"MIT"
] | null | null | null | pysimu/ssa.py | pysimu/pysimu | 646432bc96be199165b112a77b5ff650b97152ba | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 5 20:43:46 2018
@author: jmmauricio
"""
import numpy as np
def eval_A(system):
Fx = system.struct[0].Fx
Fy = system.struct[0].Fy
Gx = system.struct[0].Gx
Gy = system.struct[0].Gy
A = Fx - Fy @ np.linalg.solve(Gy,Gx)
... | 16.85 | 40 | 0.578635 |
import numpy as np
def eval_A(system):
Fx = system.struct[0].Fx
Fy = system.struct[0].Fy
Gx = system.struct[0].Gx
Gy = system.struct[0].Gy
A = Fx - Fy @ np.linalg.solve(Gy,Gx)
return A | true | true |
1c0c0ec4f136ce04fd7fd61743cc26a37e5bdf31 | 65,072 | py | Python | mockintosh/handlers.py | wenyuansong/mockintosh | 2ad4c180a1b5f01e986f3384cff6e6189689c6f2 | [
"MIT"
] | 95 | 2021-01-06T17:44:25.000Z | 2022-03-30T16:53:03.000Z | mockintosh/handlers.py | wenyuansong/mockintosh | 2ad4c180a1b5f01e986f3384cff6e6189689c6f2 | [
"MIT"
] | 129 | 2020-12-26T06:53:34.000Z | 2022-03-28T19:46:03.000Z | mockintosh/handlers.py | wenyuansong/mockintosh | 2ad4c180a1b5f01e986f3384cff6e6189689c6f2 | [
"MIT"
] | 8 | 2021-04-17T06:49:06.000Z | 2022-03-31T18:58:02.000Z | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: __init__
:synopsis: module that contains request handlers.
"""
import json
import logging
import os
import re
import time
import socket
import struct
import traceback
import copy
import threading
from urllib.parse import quote_plus, urlparse, unquote
from... | 39.581509 | 129 | 0.576254 |
import json
import logging
import os
import re
import time
import socket
import struct
import traceback
import copy
import threading
from urllib.parse import quote_plus, urlparse, unquote
from datetime import datetime, timezone
from typing import (
Union,
Optional,
Awaitable,
Tuple,
Dict
)
import... | true | true |
1c0c104b50e1762a653d23838a458de6595ceb58 | 2,241 | py | Python | src/pretalx/submission/migrations/0041_auto_20191105_0042.py | xhub/pretalx | 33bd07ec98ddeb5b7ff35fe7e30c4d38bef57d7e | [
"Apache-2.0"
] | null | null | null | src/pretalx/submission/migrations/0041_auto_20191105_0042.py | xhub/pretalx | 33bd07ec98ddeb5b7ff35fe7e30c4d38bef57d7e | [
"Apache-2.0"
] | null | null | null | src/pretalx/submission/migrations/0041_auto_20191105_0042.py | xhub/pretalx | 33bd07ec98ddeb5b7ff35fe7e30c4d38bef57d7e | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.2.4 on 2019-11-05 00:42
from django.db import migrations, models
import django.db.models.deletion
import pretalx.common.mixins.models
class Migration(migrations.Migration):
dependencies = [
('event', '0021_auto_20190429_0750'),
('submission', '0040_submission_created_data... | 45.734694 | 194 | 0.636769 |
from django.db import migrations, models
import django.db.models.deletion
import pretalx.common.mixins.models
class Migration(migrations.Migration):
dependencies = [
('event', '0021_auto_20190429_0750'),
('submission', '0040_submission_created_data'),
]
operations = [
migrations... | true | true |
1c0c1071993867a065f44ff54dfeb4c849614026 | 688 | py | Python | app/main.py | michaelawyu/stripe-google-demo | 92249ecd4d6e76ccb3406bb4f19e6cecacb25292 | [
"Apache-2.0"
] | null | null | null | app/main.py | michaelawyu/stripe-google-demo | 92249ecd4d6e76ccb3406bb4f19e6cecacb25292 | [
"Apache-2.0"
] | null | null | null | app/main.py | michaelawyu/stripe-google-demo | 92249ecd4d6e76ccb3406bb4f19e6cecacb25292 | [
"Apache-2.0"
] | 1 | 2020-12-28T20:19:10.000Z | 2020-12-28T20:19:10.000Z | import os
from flask import Flask, render_template, request
import random
from products import products
import utils
GCLOUD_PROJECT_ID = os.environ.get('GOOGLE_CLOUD_PROJECT')
app = Flask(__name__)
@app.route('/')
def display_payment_form():
product_id = random.randint(0, 5)
count = random.randint(1, 10)
... | 25.481481 | 85 | 0.748547 | import os
from flask import Flask, render_template, request
import random
from products import products
import utils
GCLOUD_PROJECT_ID = os.environ.get('GOOGLE_CLOUD_PROJECT')
app = Flask(__name__)
@app.route('/')
def display_payment_form():
product_id = random.randint(0, 5)
count = random.randint(1, 10)
... | true | true |
1c0c113f9e6b3cf1d6a0c10f5c18aac54596bc97 | 2,851 | py | Python | akshare/stock/stock_weibo_nlp.py | dindom999/akshare | 95b38d3430c71637c3ee9ba799618c20afe4a010 | [
"MIT"
] | 1 | 2021-02-03T15:58:42.000Z | 2021-02-03T15:58:42.000Z | akshare/stock/stock_weibo_nlp.py | dindom999/akshare | 95b38d3430c71637c3ee9ba799618c20afe4a010 | [
"MIT"
] | null | null | null | akshare/stock/stock_weibo_nlp.py | dindom999/akshare | 95b38d3430c71637c3ee9ba799618c20afe4a010 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2020/2/25 17:00
Desc: 金十数据中心-实时监控-微博舆情报告
https://datacenter.jin10.com/market
报告内容:时间期限可选择2小时、6小时、12小时、1天、1周、1月。
该表格展示的是在对应的时间期限内,个股在微博讨论中的人气排行指数。
红色颜色越深,表明该股票讨论热度越高,其当前的涨幅更大。
绿色颜色越深,表明该股票讨论的热度越低,其当前的跌幅更大。
"""
import time
from typing import Dict
import pandas as pd... | 32.397727 | 140 | 0.607506 | import time
from typing import Dict
import pandas as pd
import requests
def stock_js_weibo_nlp_time() -> Dict:
url = "https://datacenter-api.jin10.com/weibo/config"
payload = {"_": int(time.time() * 1000)}
headers = {
"authority": "datacenter-api.jin10.com",
"pragma": "no-cache",
... | true | true |
1c0c12a96e96529a9f42333b0a937aaebf48c42d | 11,213 | py | Python | code/datasets.py | peter0083/AttnGAN | 9f80f32ce288a79ed65b8779c37df751e2802f94 | [
"MIT"
] | null | null | null | code/datasets.py | peter0083/AttnGAN | 9f80f32ce288a79ed65b8779c37df751e2802f94 | [
"MIT"
] | null | null | null | code/datasets.py | peter0083/AttnGAN | 9f80f32ce288a79ed65b8779c37df751e2802f94 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from nltk.tokenize import RegexpTokenizer
from collections import defaultdict
from miscc.config import cfg
import torch
import torch.utils.data as data
from torch.autog... | 35.710191 | 78 | 0.556229 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from nltk.tokenize import RegexpTokenizer
from collections import defaultdict
from miscc.config import cfg
import torch
import torch.utils.data as data
from torch.autog... | true | true |
1c0c13905eaaba52a24747013356a4e02a31e9b9 | 3,147 | py | Python | common/env_wrappers.py | Scitator/Run-Skeleton-Run | c8aefbc448f2d78699355eb843c75a78ac5132a4 | [
"MIT"
] | 92 | 2017-11-16T00:51:27.000Z | 2021-05-09T14:09:08.000Z | common/env_wrappers.py | Scitator/Run-Skeleton-Run | c8aefbc448f2d78699355eb843c75a78ac5132a4 | [
"MIT"
] | 4 | 2017-12-19T13:19:18.000Z | 2018-02-26T12:18:11.000Z | common/env_wrappers.py | Scitator/Run-Skeleton-Run | c8aefbc448f2d78699355eb843c75a78ac5132a4 | [
"MIT"
] | 18 | 2017-11-16T10:07:03.000Z | 2021-10-15T04:26:48.000Z | import numpy as np
import gym
from gym.spaces import Box
from osim.env import RunEnv
from common.state_transform import StateVelCentr
class DdpgWrapper(gym.Wrapper):
def __init__(self, env, args):
gym.Wrapper.__init__(self, env)
self.state_transform = StateVelCentr(
obstacles_mode='st... | 32.78125 | 82 | 0.651096 | import numpy as np
import gym
from gym.spaces import Box
from osim.env import RunEnv
from common.state_transform import StateVelCentr
class DdpgWrapper(gym.Wrapper):
def __init__(self, env, args):
gym.Wrapper.__init__(self, env)
self.state_transform = StateVelCentr(
obstacles_mode='st... | true | true |
1c0c13e5382c43feb4e337ee55203333e791922a | 403 | py | Python | guests/migrations/0010_auto_20180927_1056.py | AntJLopez/django_wedding | 6dadca4f89e417b77613af691ecef751480d987e | [
"MIT"
] | null | null | null | guests/migrations/0010_auto_20180927_1056.py | AntJLopez/django_wedding | 6dadca4f89e417b77613af691ecef751480d987e | [
"MIT"
] | 9 | 2020-02-11T23:04:26.000Z | 2022-03-11T23:28:02.000Z | guests/migrations/0010_auto_20180927_1056.py | AntJLopez/django_wedding | 6dadca4f89e417b77613af691ecef751480d987e | [
"MIT"
] | null | null | null | # Generated by Django 2.1 on 2018-09-27 14:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('guests', '0009_rsvp_message'),
]
operations = [
migrations.AlterField(
model_name='rsvp',
name='message'... | 21.210526 | 60 | 0.560794 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('guests', '0009_rsvp_message'),
]
operations = [
migrations.AlterField(
model_name='rsvp',
name='message',
field=models.TextField(blank=Tru... | true | true |
1c0c14500892b0165a391266373fccb3a190d845 | 2,079 | py | Python | data_processing/change_id_name.py | FMsunyh/keras-retinanet | cb86a987237d3f6bd504004e2b186cf65606c890 | [
"Apache-2.0"
] | null | null | null | data_processing/change_id_name.py | FMsunyh/keras-retinanet | cb86a987237d3f6bd504004e2b186cf65606c890 | [
"Apache-2.0"
] | null | null | null | data_processing/change_id_name.py | FMsunyh/keras-retinanet | cb86a987237d3f6bd504004e2b186cf65606c890 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# @Time : 7/11/2018 9:48 AM
# @Author : sunyonghai
# @File : change_id_name.py
# @Software: ZJ_AI
import os
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import io_utils
import xml_utils
# data_path = '/home/syh/Desktop/AugMix_0709/rest_goods' #10000-29999... | 37.125 | 78 | 0.654642 | import os
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import io_utils
import xml_utils
data_path = '/home/syh/Desktop/AugMix_0709/diff' JPEGImages_dir = os.path.join(data_path, 'JPEGImages')
annotations_dir = os.path.join(data_path, 'Annotations')
data_new_path = '/home/syh/t... | true | true |
1c0c14518cba95d5e7b3e3c763bf44071cf126c4 | 9,809 | py | Python | salt/utils/win_functions.py | casselt/salt | d8a2ef4e0cd544656489d23d161928879b1fc1c0 | [
"Apache-2.0"
] | 1 | 2016-08-21T21:19:12.000Z | 2016-08-21T21:19:12.000Z | salt/utils/win_functions.py | casselt/salt | d8a2ef4e0cd544656489d23d161928879b1fc1c0 | [
"Apache-2.0"
] | 2 | 2019-03-06T20:43:44.000Z | 2019-04-10T23:56:02.000Z | salt/utils/win_functions.py | casselt/salt | d8a2ef4e0cd544656489d23d161928879b1fc1c0 | [
"Apache-2.0"
] | 1 | 2018-11-14T11:01:16.000Z | 2018-11-14T11:01:16.000Z | # -*- coding: utf-8 -*-
'''
Various functions to be used by windows during start up and to monkey patch
missing functions in other modules
'''
from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
# Import Salt Libs
from salt.exceptions import CommandExecution... | 31.847403 | 149 | 0.654807 | from __future__ import absolute_import, print_function, unicode_literals
import platform
import re
import ctypes
from salt.exceptions import CommandExecutionError
try:
import psutil
import pywintypes
import win32api
import win32net
import win32security
from win32con import HWND_BROADCAST, WM_S... | true | true |
1c0c14dcc937f049b4a4ed95cdf32514310070d5 | 17,694 | py | Python | basecam/models/card.py | sdss/baseCam | d5222f2c93df8e5b6ef894f32eca28b1cd3b3616 | [
"BSD-3-Clause"
] | null | null | null | basecam/models/card.py | sdss/baseCam | d5222f2c93df8e5b6ef894f32eca28b1cd3b3616 | [
"BSD-3-Clause"
] | 18 | 2020-01-13T20:57:48.000Z | 2021-06-22T14:43:16.000Z | basecam/models/card.py | sdss/basecam | 526f8be1b7c83e087e8f78484e63ba18531dce87 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2021-02-10
# @Filename: card.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
from __future__ import annotations
import abc
import re
import warnings
from collections.abc import Iter... | 30.665511 | 88 | 0.593591 |
from __future__ import annotations
import abc
import re
import warnings
from collections.abc import Iterable
from contextlib import contextmanager
from typing import Any, Dict, List, NamedTuple, Optional, Union, cast
import astropy.io.fits
import astropy.wcs
from basecam import __version__
from ..exceptions impor... | true | true |
1c0c1686b7ed81fd01e728ae028a0b845f4d57fb | 222 | py | Python | memorization.py | a7i7/smriti | f3fe62f7a7b16fc5cb48a9df54a18143c9f17c30 | [
"MIT"
] | null | null | null | memorization.py | a7i7/smriti | f3fe62f7a7b16fc5cb48a9df54a18143c9f17c30 | [
"MIT"
] | null | null | null | memorization.py | a7i7/smriti | f3fe62f7a7b16fc5cb48a9df54a18143c9f17c30 | [
"MIT"
] | null | null | null | from math import ceil
entropy = 2 ** 128
for i in range(10,50):
# print(i,entropy**(1/i))
numChoices = i
numElements = ceil(entropy**(1.0/i))
print(str(numElements)+' elements with '+str(numChoices)+' choices each')
| 22.2 | 74 | 0.675676 | from math import ceil
entropy = 2 ** 128
for i in range(10,50):
numChoices = i
numElements = ceil(entropy**(1.0/i))
print(str(numElements)+' elements with '+str(numChoices)+' choices each')
| true | true |
1c0c17b91e543d72810833d1787cf574b9f84d63 | 2,139 | py | Python | init_senzing_config.py | Senzing/stream-configuration | 9f4c015a6c8f886435471d2bb72150fcd70cb3c5 | [
"Apache-2.0"
] | null | null | null | init_senzing_config.py | Senzing/stream-configuration | 9f4c015a6c8f886435471d2bb72150fcd70cb3c5 | [
"Apache-2.0"
] | 12 | 2019-05-25T19:00:07.000Z | 2022-02-04T21:14:38.000Z | init_senzing_config.py | Senzing/stream-configuration | 9f4c015a6c8f886435471d2bb72150fcd70cb3c5 | [
"Apache-2.0"
] | null | null | null | #! /usr/bin/env python3
import json
try:
from G2Config import G2Config
from G2ConfigMgr import G2ConfigMgr
import G2Exception
except ImportError:
pass
def get_g2_configuration_dictionary():
result = {
"PIPELINE": {
"SUPPORTPATH": "/opt/senzing/g2/data",
"CONFIGPATH... | 27.423077 | 112 | 0.724638 |
import json
try:
from G2Config import G2Config
from G2ConfigMgr import G2ConfigMgr
import G2Exception
except ImportError:
pass
def get_g2_configuration_dictionary():
result = {
"PIPELINE": {
"SUPPORTPATH": "/opt/senzing/g2/data",
"CONFIGPATH": "/opt/senzing/g2/data... | true | true |
1c0c17c71df2babd2d22fab2f04040c440ae1cec | 18,495 | py | Python | sdk/python/pulumi_azure_native/network/v20180801/interface_endpoint.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/network/v20180801/interface_endpoint.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/network/v20180801/interface_endpoint.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 48.289817 | 2,861 | 0.665693 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['InterfaceEndpointArgs', 'InterfaceEndpoint']
@pulumi.input_type
class InterfaceEndpointArg... | true | true |
1c0c17f3defb4febba266784c6088d0b3ad3d382 | 1,624 | py | Python | wongkar_selling/wongkar_selling/get_invoice.py | bobzz-zone/wongkar_selling | 9d5c06e95aac3d69a46451b3c7f518e05b73d068 | [
"MIT"
] | null | null | null | wongkar_selling/wongkar_selling/get_invoice.py | bobzz-zone/wongkar_selling | 9d5c06e95aac3d69a46451b3c7f518e05b73d068 | [
"MIT"
] | null | null | null | wongkar_selling/wongkar_selling/get_invoice.py | bobzz-zone/wongkar_selling | 9d5c06e95aac3d69a46451b3c7f518e05b73d068 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2021, w and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import date
import datetime
from erpnext.accounts.utils import get_fiscal_years, val... | 41.641026 | 220 | 0.746921 |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import date
import datetime
from erpnext.accounts.utils import get_fiscal_years, validate_fiscal_year, get_account_currency
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension impor... | true | true |
1c0c186113d08f1b840d65be6a51ed78839c6612 | 11,583 | py | Python | src/pytrademl/utilities/plot_utilities.py | m-rubik/Account-Manager | 7438baf402ac471f6da3686d7a01ed9eeb3fba88 | [
"MIT"
] | 4 | 2020-08-12T00:09:07.000Z | 2020-11-02T18:39:49.000Z | src/pytrademl/utilities/plot_utilities.py | m-rubik/Account-Manager | 7438baf402ac471f6da3686d7a01ed9eeb3fba88 | [
"MIT"
] | null | null | null | src/pytrademl/utilities/plot_utilities.py | m-rubik/Account-Manager | 7438baf402ac471f6da3686d7a01ed9eeb3fba88 | [
"MIT"
] | 1 | 2021-11-09T23:02:22.000Z | 2021-11-09T23:02:22.000Z | import matplotlib.pyplot as plt
import numpy as np
import pytrademl.utilities.dataframe_utilities as dataframe_utilities
import matplotlib.dates as mdates
from matplotlib import style
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
style.use('ggplot')
def generate_correlat... | 36.424528 | 119 | 0.632738 | import matplotlib.pyplot as plt
import numpy as np
import pytrademl.utilities.dataframe_utilities as dataframe_utilities
import matplotlib.dates as mdates
from matplotlib import style
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
style.use('ggplot')
def generate_correlat... | true | true |
1c0c189420c1e8057e7ed9ff82b43e589a2c68e1 | 14,271 | py | Python | examples/legacy/run_openai_gpt.py | MarcelGM/transformers | aad1d9b6d5c58fd974618ac0aead1c5bd1119467 | [
"Apache-2.0"
] | 101 | 2021-12-22T00:03:51.000Z | 2022-03-30T07:39:09.000Z | examples/legacy/run_openai_gpt.py | MarcelGM/transformers | aad1d9b6d5c58fd974618ac0aead1c5bd1119467 | [
"Apache-2.0"
] | 7 | 2021-07-16T21:47:19.000Z | 2022-03-18T20:26:53.000Z | examples/legacy/run_openai_gpt.py | MarcelGM/transformers | aad1d9b6d5c58fd974618ac0aead1c5bd1119467 | [
"Apache-2.0"
] | 30 | 2021-04-30T07:11:22.000Z | 2022-03-15T19:34:58.000Z | #!/usr/bin/env python
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | 44.457944 | 128 | 0.66947 | import argparse
import csv
import logging
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset
from tqdm import tqdm, trange
from transformers import (
CONFIG_NAME,
WEIGHTS_NAME,
AdamW,
OpenAIGPTDoubleHeadsMode... | true | true |
1c0c1960877bebd92bc9fc0a10c690007c6a70b4 | 13,845 | py | Python | lfd/mmqe/max_margin.py | def670/lfd | 9fef15f556cba49dd4b42c0c29505a4137f95fc5 | [
"BSD-2-Clause"
] | 36 | 2015-05-22T14:47:18.000Z | 2021-07-27T15:30:36.000Z | lfd/mmqe/max_margin.py | jeffmahler/lfd | ecc6b934db098c0b1af9946454917b6dc911cb74 | [
"BSD-2-Clause"
] | null | null | null | lfd/mmqe/max_margin.py | jeffmahler/lfd | ecc6b934db098c0b1af9946454917b6dc911cb74 | [
"BSD-2-Clause"
] | 13 | 2015-05-22T15:38:07.000Z | 2021-07-28T03:20:35.000Z | #!/usr/bin/env python
try:
import gurobipy as grb
USE_GUROBI = True
GRB = grb.GRB # constants for gurobi
except ImportError:
USE_GUROBI = False
import h5py
import sys
import os
import numpy as np
eps = 10**-8
MAX_ITER=1000
"""
functions and classes for setting up and running max margin, uses gurobi... | 37.418919 | 194 | 0.574576 |
try:
import gurobipy as grb
USE_GUROBI = True
GRB = grb.GRB except ImportError:
USE_GUROBI = False
import h5py
import sys
import os
import numpy as np
eps = 10**-8
MAX_ITER=1000
"""
functions and classes for setting up and running max margin, uses gurobi as the basic optimizer
"""
class MaxMargin... | false | true |
1c0c19a19186a40a2abb3b753389cc65341129b0 | 13,151 | py | Python | Contrib-Microsoft/Olympus_rack_manager/python-ocs/commonapi/controls/blade_fw_update.py | opencomputeproject/Rack-Manager | e1a61d3eeeba0ff655fe9c1301e8b510d9b2122a | [
"MIT"
] | 5 | 2019-11-11T07:57:26.000Z | 2022-03-28T08:26:53.000Z | Contrib-Microsoft/Olympus_rack_manager/python-ocs/commonapi/controls/blade_fw_update.py | opencomputeproject/Rack-Manager | e1a61d3eeeba0ff655fe9c1301e8b510d9b2122a | [
"MIT"
] | 3 | 2019-09-05T21:47:07.000Z | 2019-09-17T18:10:45.000Z | Contrib-Microsoft/Olympus_rack_manager/python-ocs/commonapi/controls/blade_fw_update.py | opencomputeproject/Rack-Manager | e1a61d3eeeba0ff655fe9c1301e8b510d9b2122a | [
"MIT"
] | 11 | 2019-07-20T00:16:32.000Z | 2022-01-11T14:17:48.000Z | # Copyright (C) Microsoft Corporation. All rights reserved.
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#!/usr/bin... | 34.069948 | 109 | 0.62231 |
import sys
import time
import os.path
import paramiko
from ocspaths import *
from argparse import ArgumentParser
from ctypes import create_string_buffer
from lib_utils import get_blade_map_library
from utils import set_failure_dict, set_success_dict, completion_code
from ipmicmd_library import get_ipmi_interface, g... | false | true |
1c0c1a1403c861d8e637049ce4cf4a83ac34eee7 | 10,678 | py | Python | python/apogee/apred/lsfmap.py | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
] | 5 | 2019-04-11T13:35:24.000Z | 2019-11-14T06:12:51.000Z | python/apogee/apred/lsfmap.py | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
] | null | null | null | python/apogee/apred/lsfmap.py | dnidever/apogee | 83ad7496a0b4193df9e2c01b06dc36cb879ea6c1 | [
"BSD-3-Clause"
] | 5 | 2018-09-20T22:07:43.000Z | 2021-01-15T07:13:38.000Z | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
from astropy.io import fits
from astropy.modeling import models,fitting
from astropy.convolution import convolve, Box2DKernel
from apogee.utils import apload
from pyvista import image
from tools import ... | 38.135714 | 163 | 0.595617 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
from astropy.io import fits
from astropy.modeling import models,fitting
from astropy.convolution import convolve, Box2DKernel
from apogee.utils import apload
from pyvista import image
from tools import ... | true | true |
1c0c1a9265be7e8d25e16135fd1b154cbda52bf9 | 2,099 | py | Python | cvat/apps/onepanelio/backends.py | javoweb/cvat | 684544d2a06c192e7155f655897e6360b4a3be37 | [
"MIT"
] | 2 | 2020-07-24T18:12:18.000Z | 2020-08-12T09:14:07.000Z | cvat/apps/onepanelio/backends.py | javoweb/cvat | 684544d2a06c192e7155f655897e6360b4a3be37 | [
"MIT"
] | 4 | 2018-11-20T05:50:58.000Z | 2020-11-12T22:51:35.000Z | cvat/apps/onepanelio/backends.py | javoweb/cvat | 684544d2a06c192e7155f655897e6360b4a3be37 | [
"MIT"
] | 5 | 2020-07-01T18:02:48.000Z | 2021-01-22T02:21:48.000Z | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
from cvat.apps.onepanelio.middleware import OnepanelCoreTokenAuthentication
from cvat.apps.onepanelio.models import MirrorOnepanelUser, OnepanelAuth
UserModel = get_user_model()
class OnepanelIORestBackend(ModelBacke... | 47.704545 | 90 | 0.688423 | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
from cvat.apps.onepanelio.middleware import OnepanelCoreTokenAuthentication
from cvat.apps.onepanelio.models import MirrorOnepanelUser, OnepanelAuth
UserModel = get_user_model()
class OnepanelIORestBackend(ModelBacke... | true | true |
1c0c1ab93c581ab707a4d8f64f35dfd7f2937f79 | 928 | py | Python | src/modules/agents/rnn_agent.py | benellis3/pymarl2 | 0875995a0e0b9692ea64484478b369c7f6c0cf44 | [
"Apache-2.0"
] | 401 | 2021-02-23T02:42:42.000Z | 2022-03-21T08:22:37.000Z | src/modules/agents/rnn_agent.py | benellis3/pymarl2 | 0875995a0e0b9692ea64484478b369c7f6c0cf44 | [
"Apache-2.0"
] | 21 | 2021-04-10T10:05:07.000Z | 2022-03-29T10:09:03.000Z | src/modules/agents/rnn_agent.py | benellis3/pymarl2 | 0875995a0e0b9692ea64484478b369c7f6c0cf44 | [
"Apache-2.0"
] | 90 | 2021-02-15T08:37:04.000Z | 2022-03-21T06:37:15.000Z | import torch.nn as nn
import torch.nn.functional as F
class RNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(RNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, args.rnn_hidden_dim)
self.rnn = nn.GRUCell(args.rnn_hidden_dim, args.rnn_hidd... | 35.692308 | 77 | 0.635776 | import torch.nn as nn
import torch.nn.functional as F
class RNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(RNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, args.rnn_hidden_dim)
self.rnn = nn.GRUCell(args.rnn_hidden_dim, args.rnn_hidd... | true | true |
1c0c1aba650170cc746211eb073b59b650fd5db8 | 16,264 | py | Python | QBG/Tester/BackTester.py | GYMS-PKU/Daily-Frequency-Quant | 808eda9930efecff04ecf98abf617404cadd0003 | [
"MIT"
] | 3 | 2021-11-21T04:35:04.000Z | 2022-03-04T09:19:53.000Z | QBG/Tester/BackTester.py | GYMS-PKU/Daily-Frequency-Quant | 808eda9930efecff04ecf98abf617404cadd0003 | [
"MIT"
] | null | null | null | QBG/Tester/BackTester.py | GYMS-PKU/Daily-Frequency-Quant | 808eda9930efecff04ecf98abf617404cadd0003 | [
"MIT"
] | 5 | 2021-10-03T00:00:22.000Z | 2022-03-07T09:02:00.000Z | # Copyright (c) 2021 Dai HBG
"""
BackTester类根据传入信号以及交易逻辑进行交易
开发日志
2021-09-07
-- 更新:BackTester类统计pnl序列的平均日收益,最大回撤,标准差,夏普比,最长亏损时间
2021-09-11
-- 修复:回测时剔除涨停板
2021-09-21
-- 修复:回测是要根据上一期的持仓确定涨停板是否剔除,有可能涨停的股票是有持仓的
"""
import numpy as np
import datetime
class BackTester:
def __init__(self, data, signal=None):
... | 43.486631 | 117 | 0.457759 |
import numpy as np
import datetime
class BackTester:
def __init__(self, data, signal=None):
self.signal = signal
self.data = data
self.pnl = [] self.cumulated_pnl = [] self.market_pnl = [] self.market_cumulated_pnl = []
self.max_dd = 0 self.mea... | true | true |
1c0c1b3205ca67eb313a064634f85af13d773bcd | 489 | py | Python | HelloWorld/app.py | Licas/pythonwebprojects | 0212b0758de6e28e3a074a224acd57c391f20755 | [
"MIT"
] | null | null | null | HelloWorld/app.py | Licas/pythonwebprojects | 0212b0758de6e28e3a074a224acd57c391f20755 | [
"MIT"
] | null | null | null | HelloWorld/app.py | Licas/pythonwebprojects | 0212b0758de6e28e3a074a224acd57c391f20755 | [
"MIT"
] | null | null | null | # Formatted string example
name = input("What's your name? ")
msg = f'Your name is {name}'
length = len(msg)
print(msg.upper())
print(msg, " [", length,"]")
print("Msg contains word Mark at index: ",msg.find('Mark'))
print("Msg contains word Mark? ",'Mark' in msg)
print("I replaced your name in the msg: ", msg.replace(... | 27.166667 | 70 | 0.683027 | name = input("What's your name? ")
msg = f'Your name is {name}'
length = len(msg)
print(msg.upper())
print(msg, " [", length,"]")
print("Msg contains word Mark at index: ",msg.find('Mark'))
print("Msg contains word Mark? ",'Mark' in msg)
print("I replaced your name in the msg: ", msg.replace(name, 'Frank'))
print("Capi... | true | true |
1c0c1b72615093dff44a0082476bb36b291f37d0 | 3,227 | py | Python | crossword_libs/word_utils/words.py | richard-shepherd/crossword-helper | f7d9bc7e2cce537f7280a1defa5c846ee236b0a4 | [
"MIT"
] | null | null | null | crossword_libs/word_utils/words.py | richard-shepherd/crossword-helper | f7d9bc7e2cce537f7280a1defa5c846ee236b0a4 | [
"MIT"
] | null | null | null | crossword_libs/word_utils/words.py | richard-shepherd/crossword-helper | f7d9bc7e2cce537f7280a1defa5c846ee236b0a4 | [
"MIT"
] | null | null | null | import re
from .anagram_helper import AnagramHelper
from .definition_helper import DefinitionHelper
from .word_manager import WordManager
from .word_utils import WordUtils
class Words(object):
"""
Provides a fluent interface for looking up words given certain constraints.
Examples:
- Words().match(".... | 29.072072 | 89 | 0.601487 | import re
from .anagram_helper import AnagramHelper
from .definition_helper import DefinitionHelper
from .word_manager import WordManager
from .word_utils import WordUtils
class Words(object):
def __init__(self):
self.words = WordManager().get_words()
def __iter_... | true | true |
1c0c1bade83e4bccd90137cf28a2c3578f0d4f7f | 4,167 | py | Python | VisionMain/skin_cancer_coreml_model/train_skin_cancer_app.py | team-sparrow/Vision | e827e5a127cf429bcffb72af2be0c8d1dca001b0 | [
"MIT"
] | 184 | 2017-11-15T16:09:06.000Z | 2022-03-09T11:46:32.000Z | VisionMain/skin_cancer_coreml_model/train_skin_cancer_app.py | team-sparrow/Vision | e827e5a127cf429bcffb72af2be0c8d1dca001b0 | [
"MIT"
] | 17 | 2017-11-22T04:44:22.000Z | 2022-03-05T16:08:56.000Z | VisionMain/skin_cancer_coreml_model/train_skin_cancer_app.py | team-sparrow/Vision | e827e5a127cf429bcffb72af2be0c8d1dca001b0 | [
"MIT"
] | 112 | 2017-11-15T21:12:18.000Z | 2022-03-25T16:08:31.000Z |
# coding: utf-8
# In[1]:
from sklearn.datasets import load_files
from keras.utils import np_utils
import numpy as np
from glob import glob
import keras
# define function to load train, test, and validation datasets
def load_dataset(path):
data = load_files(path)
condition_files = np.array(data['filen... | 31.80916 | 120 | 0.726422 |
from sklearn.datasets import load_files
from keras.utils import np_utils
import numpy as np
from glob import glob
import keras
def load_dataset(path):
data = load_files(path)
condition_files = np.array(data['filenames'])
condition_targets = np_utils.to_categorical(np.array(data['target']), 2)
... | true | true |
1c0c1c198c11512ebe47ade9bc801d1f022baa8f | 29,503 | py | Python | tests/test_serialization.py | koodaa-team/marshmallow | 9cabe916520def08b59907482c842e37112f7289 | [
"MIT"
] | null | null | null | tests/test_serialization.py | koodaa-team/marshmallow | 9cabe916520def08b59907482c842e37112f7289 | [
"MIT"
] | null | null | null | tests/test_serialization.py | koodaa-team/marshmallow | 9cabe916520def08b59907482c842e37112f7289 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests for field serialization."""
from collections import namedtuple
import datetime as dt
import itertools
import decimal
import uuid
import pytest
from marshmallow import Schema, fields, utils
from marshmallow.exceptions import ValidationError
from marshmallow.compat import basestring, Or... | 36.786783 | 120 | 0.626546 | from collections import namedtuple
import datetime as dt
import itertools
import decimal
import uuid
import pytest
from marshmallow import Schema, fields, utils
from marshmallow.exceptions import ValidationError
from marshmallow.compat import basestring, OrderedDict
from marshmallow.utils import missing as missing_
... | true | true |
1c0c1cc2132cb2417cc8a5b260bdd2c54cc4d64c | 1,055 | py | Python | worker.py | rchacon/sms-service | 42cb334b4a9e49d65740a5d86bd7d513d13a667b | [
"MIT"
] | 1 | 2017-10-16T13:08:03.000Z | 2017-10-16T13:08:03.000Z | worker.py | rchacon/sms-service | 42cb334b4a9e49d65740a5d86bd7d513d13a667b | [
"MIT"
] | null | null | null | worker.py | rchacon/sms-service | 42cb334b4a9e49d65740a5d86bd7d513d13a667b | [
"MIT"
] | null | null | null | """
Listen to rabbit and send text messages
"""
import os
import json
import pika
from googlevoice import Voice
def send_sms(message, phone):
voice = Voice()
voice.login()
voice.send_sms(phone, message)
def callback(ch, method, properties, body):
print(' [x] Received %r' % body)
data = json.l... | 19.537037 | 60 | 0.640758 | import os
import json
import pika
from googlevoice import Voice
def send_sms(message, phone):
voice = Voice()
voice.login()
voice.send_sms(phone, message)
def callback(ch, method, properties, body):
print(' [x] Received %r' % body)
data = json.loads(body)
try:
send_sms(data['mess... | true | true |
1c0c1d2632e14d21c78e42db016ed377eac477c7 | 1,469 | py | Python | answer/04.py | harurunrunrun/edu90_myanswer | 3aeaf9cb68a3bafe550681c6d240c622678c6d03 | [
"CC0-1.0"
] | null | null | null | answer/04.py | harurunrunrun/edu90_myanswer | 3aeaf9cb68a3bafe550681c6d240c622678c6d03 | [
"CC0-1.0"
] | null | null | null | answer/04.py | harurunrunrun/edu90_myanswer | 3aeaf9cb68a3bafe550681c6d240c622678c6d03 | [
"CC0-1.0"
] | 1 | 2021-06-04T06:08:15.000Z | 2021-06-04T06:08:15.000Z | class INPUT:
def __init__(self):
self.l=open(0).read().split()[::-1]
self.length=len(self.l)
return
def stream(self,k=1,f=int,f2=False):
assert(-1<k)
m=self.length
if m==0 or m<k:
raise Exception("There is no input!")
elif f!=str:
if k==0:
self.length=0
... | 22.257576 | 56 | 0.493533 | class INPUT:
def __init__(self):
self.l=open(0).read().split()[::-1]
self.length=len(self.l)
return
def stream(self,k=1,f=int,f2=False):
assert(-1<k)
m=self.length
if m==0 or m<k:
raise Exception("There is no input!")
elif f!=str:
if k==0:
self.length=0
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.