hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
790cded3b9600099b43dc5f20edff876ac4d1fd1 | 597 | py | Python | mmocr/utils/__init__.py | jeffreykuang/mmocr-1 | b17304edeb493b0a4d7224c23d23b952350d0db5 | [
"Apache-2.0"
] | 1 | 2021-04-19T02:26:57.000Z | 2021-04-19T02:26:57.000Z | mmocr/utils/__init__.py | jeffreykuang/mmocr-1 | b17304edeb493b0a4d7224c23d23b952350d0db5 | [
"Apache-2.0"
] | null | null | null | mmocr/utils/__init__.py | jeffreykuang/mmocr-1 | b17304edeb493b0a4d7224c23d23b952350d0db5 | [
"Apache-2.0"
] | 1 | 2021-04-16T02:01:26.000Z | 2021-04-16T02:01:26.000Z | from mmcv.utils import Registry, build_from_cfg
from .check_argument import (equal_len, is_2dlist, is_3dlist, is_ndarray_list,
is_none_or_type, is_type_list, valid_boundary)
from .collect_env import collect_env
from .img_util import drop_orientation
from .lmdb_util import lmdb_converter
fr... | 37.3125 | 78 | 0.747069 | from mmcv.utils import Registry, build_from_cfg
from .check_argument import (equal_len, is_2dlist, is_3dlist, is_ndarray_list,
is_none_or_type, is_type_list, valid_boundary)
from .collect_env import collect_env
from .img_util import drop_orientation
from .lmdb_util import lmdb_converter
fr... | true | true |
790cdf8429094e91808ea1c5cdc5626621fd9ba5 | 1,578 | py | Python | common/configParams.py | MistSun-Chen/py_verifier | 7e9161d1fdbb611fe4be5eeb2f89a6286fa7b555 | [
"MIT"
] | null | null | null | common/configParams.py | MistSun-Chen/py_verifier | 7e9161d1fdbb611fe4be5eeb2f89a6286fa7b555 | [
"MIT"
] | null | null | null | common/configParams.py | MistSun-Chen/py_verifier | 7e9161d1fdbb611fe4be5eeb2f89a6286fa7b555 | [
"MIT"
] | null | null | null | import os
class ConfigParams:
def __init__(self,configPath):
self.env_dist = os.environ
#权限验证
self.api_key = ""
# userID = ""
# ip = "0.0.0.0"
#模型相关存放根目录
self.modelPath = os.path.join(os.getcwd(),"model")
cpuCores = 0
threads = 2
por... | 26.3 | 131 | 0.576046 | import os
class ConfigParams:
def __init__(self,configPath):
self.env_dist = os.environ
self.api_key = ""
self.modelPath = os.path.join(os.getcwd(),"model")
cpuCores = 0
threads = 2
port = 33388
batchSize = 10
... | true | true |
790cdfb802dac570187a5ff4b18edd7acd0d9c4a | 2,658 | py | Python | udacity_deep_learning/download_data.py | fcarsten/ai_playground | ba52378a56b8a4400d594ae70ff03af2a0e36f12 | [
"Apache-2.0"
] | null | null | null | udacity_deep_learning/download_data.py | fcarsten/ai_playground | ba52378a56b8a4400d594ae70ff03af2a0e36f12 | [
"Apache-2.0"
] | null | null | null | udacity_deep_learning/download_data.py | fcarsten/ai_playground | ba52378a56b8a4400d594ae70ff03af2a0e36f12 | [
"Apache-2.0"
] | null | null | null | import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
url = 'https://commondatastorage.googleapis.com/books1000/'
last_percent_reported = None
data_root = '.' # Change me to store data elsewhere
def download_progress_hook(count, blockSize, totalSize):
"""A hook to report the progr... | 35.918919 | 99 | 0.674191 | import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
url = 'https://commondatastorage.googleapis.com/books1000/'
last_percent_reported = None
data_root = '.'
def download_progress_hook(count, blockSize, totalSize):
global last_percent_reported
percent = int(count * blockSize... | true | true |
790ce08cc2acdf83deaa1a6f0546f793d2ec0e50 | 2,597 | py | Python | check_and_approve_hits.py | maxspero/ccr-amt | 11bd8ec499e263034cee52996f6ce9974cfbea10 | [
"MIT"
] | null | null | null | check_and_approve_hits.py | maxspero/ccr-amt | 11bd8ec499e263034cee52996f6ce9974cfbea10 | [
"MIT"
] | null | null | null | check_and_approve_hits.py | maxspero/ccr-amt | 11bd8ec499e263034cee52996f6ce9974cfbea10 | [
"MIT"
] | null | null | null | import argparse, json
import simpleamt
import MySQLdb
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()])
parser.add_argument('-f', action='store_true', default=False)
args = parser.parse_args()
mtc = simpleamt.get_mturk_connection_from_args(args)
approve_ids... | 36.069444 | 97 | 0.630343 | import argparse, json
import simpleamt
import MySQLdb
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()])
parser.add_argument('-f', action='store_true', default=False)
args = parser.parse_args()
mtc = simpleamt.get_mturk_connection_from_args(args)
approve_ids... | false | true |
790ce14c7c3788fda8bc517d6910cbcd5ead08b9 | 2,153 | py | Python | turk/turk/report/pending_order_detail/pending_order_detail.py | Ehtasham-Muzaffar/turk | edb064eed6dac95751f6fe7e510d3a5b3b9b5ff9 | [
"MIT"
] | 1 | 2021-08-07T12:48:02.000Z | 2021-08-07T12:48:02.000Z | turk/turk/report/pending_order_detail/pending_order_detail.py | Ehtasham-Muzaffar/turk | edb064eed6dac95751f6fe7e510d3a5b3b9b5ff9 | [
"MIT"
] | null | null | null | turk/turk/report/pending_order_detail/pending_order_detail.py | Ehtasham-Muzaffar/turk | edb064eed6dac95751f6fe7e510d3a5b3b9b5ff9 | [
"MIT"
] | 4 | 2021-01-16T06:14:58.000Z | 2022-02-07T06:36:41.000Z | # Copyright (c) 2013, RC and contributors
# For license information, please see license.txt
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"fieldname": "po_number",
"fieldtype": "Data",
"... | 26.580247 | 103 | 0.640502 |
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"fieldname": "po_number",
"fieldtype": "Data",
"label": "Po Number",
"width": 120
},
{
"fieldname": "ordered_qty",
"fieldtype... | true | true |
790ce1a643131eb5ab1c1570f55e4988783c31d3 | 868 | py | Python | python_api/notifications/models.py | hyecheon/python_api | 150bad58c21da4c3a635454b768722958035b320 | [
"MIT"
] | null | null | null | python_api/notifications/models.py | hyecheon/python_api | 150bad58c21da4c3a635454b768722958035b320 | [
"MIT"
] | 20 | 2020-06-05T16:58:52.000Z | 2022-03-11T23:23:08.000Z | python_api/notifications/models.py | hyecheon/python_api | 150bad58c21da4c3a635454b768722958035b320 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from python_api.users import models as user_models
from python_api.images import models as image_models
@python_2_unicode_compatible
class Notification(image_models.TimeStampedModel):
TYPE_CHOICES = (
('like', 'Like... | 34.72 | 77 | 0.717742 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from python_api.users import models as user_models
from python_api.images import models as image_models
@python_2_unicode_compatible
class Notification(image_models.TimeStampedModel):
TYPE_CHOICES = (
('like', 'Like... | true | true |
790ce1d653bc2584a6b89c61dfa40813affa5835 | 544 | py | Python | examples/multiprocessing/joinable_queue.py | otrack/lithops | 81ffe3aa16f4483881e172e8805966735cc6e850 | [
"Apache-2.0"
] | null | null | null | examples/multiprocessing/joinable_queue.py | otrack/lithops | 81ffe3aa16f4483881e172e8805966735cc6e850 | [
"Apache-2.0"
] | null | null | null | examples/multiprocessing/joinable_queue.py | otrack/lithops | 81ffe3aa16f4483881e172e8805966735cc6e850 | [
"Apache-2.0"
] | null | null | null | from lithops.multiprocessing import Process, JoinableQueue
def worker(q):
working = True
while working:
x = q.get()
# Do work that may fail
assert x < 10
# Confirm task
q.task_done()
if x == -1:
working = False
if __name__ == '__main__':
q =... | 16.484848 | 58 | 0.527574 | from lithops.multiprocessing import Process, JoinableQueue
def worker(q):
working = True
while working:
x = q.get()
assert x < 10
q.task_done()
if x == -1:
working = False
if __name__ == '__main__':
q = JoinableQueue()
p = Process(targ... | true | true |
790ce2149d0e699508616c413b6925e846338115 | 10,198 | py | Python | hyperengine/tests/spec_test.py | KOLANICH/hyper-engine | 60ba73438fdbef9320a849ee65f36da977f68eca | [
"Apache-2.0"
] | null | null | null | hyperengine/tests/spec_test.py | KOLANICH/hyper-engine | 60ba73438fdbef9320a849ee65f36da977f68eca | [
"Apache-2.0"
] | null | null | null | hyperengine/tests/spec_test.py | KOLANICH/hyper-engine | 60ba73438fdbef9320a849ee65f36da977f68eca | [
"Apache-2.0"
] | null | null | null | #! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import six
import unittest
from hyperengine.spec import *
class SpecTest(unittest.TestCase):
def test_zero_nodes(self):
def check_zero_nodes(spec):
parsed = ParsedSpec(spec)
self.assertEqual(parsed.size(), 0)
self.assertEqu... | 32.170347 | 91 | 0.63836 |
__author__ = 'maxim'
import six
import unittest
from hyperengine.spec import *
class SpecTest(unittest.TestCase):
def test_zero_nodes(self):
def check_zero_nodes(spec):
parsed = ParsedSpec(spec)
self.assertEqual(parsed.size(), 0)
self.assertEqual(spec, parsed.instantiate([]))
che... | true | true |
790ce248c8c6a2c1c8d8f221b0e73b7f35a1261b | 5,698 | py | Python | tensorflow_datasets/image_classification/imagenet2012_real.py | sourcery-ai-bot/datasets | b623ab0abf3f03bacf6a7ba22c8d37bf76a4db28 | [
"Apache-2.0"
] | 1 | 2021-05-10T10:41:27.000Z | 2021-05-10T10:41:27.000Z | tensorflow_datasets/image_classification/imagenet2012_real.py | sourcery-ai-bot/datasets | b623ab0abf3f03bacf6a7ba22c8d37bf76a4db28 | [
"Apache-2.0"
] | null | null | null | tensorflow_datasets/image_classification/imagenet2012_real.py | sourcery-ai-bot/datasets | b623ab0abf3f03bacf6a7ba22c8d37bf76a4db28 | [
"Apache-2.0"
] | 1 | 2021-07-04T11:07:35.000Z | 2021-07-04T11:07:35.000Z | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 37.986667 | 220 | 0.707617 |
import json
import os
import tarfile
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_DESCRIPTION = '''\
This dataset contains ILSVRC-2012 (ImageNet) validation images augmented with a
new set of "Re-Assessed" (ReaL) labels from the "Are we done with ImageNet"
paper, s... | true | true |
790ce30d76cd775f97e66642375f6d284899897c | 7,570 | py | Python | preprocessing.py | enkaranfiles/predict-future-sales | 528d004b78b5c0d41720fc46daa487e3928c045e | [
"MIT"
] | null | null | null | preprocessing.py | enkaranfiles/predict-future-sales | 528d004b78b5c0d41720fc46daa487e3928c045e | [
"MIT"
] | null | null | null | preprocessing.py | enkaranfiles/predict-future-sales | 528d004b78b5c0d41720fc46daa487e3928c045e | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from itertools import product
from sklearn.preprocessing import LabelEncoder
# =============================================================================
# The lines where we processed our data
# ==============... | 44.529412 | 204 | 0.660238 | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from itertools import product
from sklearn.preprocessing import LabelEncoder
def lag_feature(df, lags, col):
tmp = df[['date_block_num','shop_id','item_id',col]]
for i in lags:
shifted = tmp.co... | true | true |
790ce4877f4cf22fe334c3b0f1ac1df422642dee | 7,542 | py | Python | tests/unit/drivers/test_chunk2doc_rank_drivers.py | musa-atlihan/jina | 9d9cbe1dad2703e2da10761a11c66abcc76dd8b8 | [
"Apache-2.0"
] | 2 | 2021-04-22T16:59:02.000Z | 2021-04-22T17:14:32.000Z | tests/unit/drivers/test_chunk2doc_rank_drivers.py | musa-atlihan/jina | 9d9cbe1dad2703e2da10761a11c66abcc76dd8b8 | [
"Apache-2.0"
] | null | null | null | tests/unit/drivers/test_chunk2doc_rank_drivers.py | musa-atlihan/jina | 9d9cbe1dad2703e2da10761a11c66abcc76dd8b8 | [
"Apache-2.0"
] | null | null | null | import pytest
from jina.drivers.rank import Chunk2DocRankDriver
from jina.executors.rankers import Chunk2DocRanker
from jina.hub.rankers.MaxRanker import MaxRanker
from jina.hub.rankers.MinRanker import MinRanker
from jina.proto import jina_pb2
class MockLengthRanker(Chunk2DocRanker):
def __init__(self, *args, *... | 36.790244 | 105 | 0.620525 | import pytest
from jina.drivers.rank import Chunk2DocRankDriver
from jina.executors.rankers import Chunk2DocRanker
from jina.hub.rankers.MaxRanker import MaxRanker
from jina.hub.rankers.MinRanker import MinRanker
from jina.proto import jina_pb2
class MockLengthRanker(Chunk2DocRanker):
def __init__(self, *args, *... | true | true |
790ce63bd651890a0c39fd212c1219cc44737519 | 9,647 | py | Python | ts-avatar-service/base64toimage.py | docc-lab/train-ticket | 350f62000e6658e0e543730580c599d8558253e7 | [
"Apache-2.0"
] | 341 | 2018-11-23T15:19:33.000Z | 2022-03-31T14:29:42.000Z | ts-avatar-service/base64toimage.py | docc-lab/train-ticket | 350f62000e6658e0e543730580c599d8558253e7 | [
"Apache-2.0"
] | 107 | 2018-12-27T11:10:09.000Z | 2022-03-30T02:26:21.000Z | ts-avatar-service/base64toimage.py | docc-lab/train-ticket | 350f62000e6658e0e543730580c599d8558253e7 | [
"Apache-2.0"
] | 211 | 2018-12-06T15:49:32.000Z | 2022-03-31T16:02:42.000Z | import base64
import numpy as np
import cv2
path_save = "./images/"
def base64_cv2(base64_str):
imgString = base64.b64decode(base64_str)
nparr = np.fromstring(imgString,np.uint8)
image = cv2.imdecode(nparr,cv2.IMREAD_COLOR)
a = cv2.imwrite(path_save + "img_face_1" + ".jpg", image)
print(a)
r... | 438.5 | 9,266 | 0.94589 | import base64
import numpy as np
import cv2
path_save = "./images/"
def base64_cv2(base64_str):
imgString = base64.b64decode(base64_str)
nparr = np.fromstring(imgString,np.uint8)
image = cv2.imdecode(nparr,cv2.IMREAD_COLOR)
a = cv2.imwrite(path_save + "img_face_1" + ".jpg", image)
print(a)
r... | true | true |
790ce7637a5ce9f336f48ba6550fc45f58aa80bf | 1,108 | py | Python | rate/users/tests/test_forms.py | Jeongkiwon/rate_everything | 0931483a823288e75e0cb7a467b99594994911d4 | [
"MIT"
] | 1 | 2019-01-10T04:48:44.000Z | 2019-01-10T04:48:44.000Z | rate/users/tests/test_forms.py | Jeongkiwon/rate_everything | 0931483a823288e75e0cb7a467b99594994911d4 | [
"MIT"
] | 5 | 2020-06-05T19:54:51.000Z | 2021-09-08T00:55:43.000Z | rate/users/tests/test_forms.py | Jeongkiwon/rate_everything | 0931483a823288e75e0cb7a467b99594994911d4 | [
"MIT"
] | null | null | null | import pytest
from rate.users.forms import UserCreationForm
from rate.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
def test_clean_username(self):
# A user with proto_user params does not exist yet.
proto_user = UserFactory.build()
... | 26.380952 | 59 | 0.590253 | import pytest
from rate.users.forms import UserCreationForm
from rate.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
def test_clean_username(self):
proto_user = UserFactory.build()
form = UserCreationForm(
{
... | true | true |
790ce9b259eeb276fefbe96bf7f91079330b857a | 6,051 | py | Python | cx_Oracle-doc/test/uLobVar.py | zaygeee/MASTER | 6e11ec3383a13ae6f86ab1a23613bee7a2fc9ed5 | [
"bzip2-1.0.6"
] | null | null | null | cx_Oracle-doc/test/uLobVar.py | zaygeee/MASTER | 6e11ec3383a13ae6f86ab1a23613bee7a2fc9ed5 | [
"bzip2-1.0.6"
] | null | null | null | cx_Oracle-doc/test/uLobVar.py | zaygeee/MASTER | 6e11ec3383a13ae6f86ab1a23613bee7a2fc9ed5 | [
"bzip2-1.0.6"
] | null | null | null | """Module for testing LOB (CLOB and BLOB) variables."""
class TestLobVar(BaseTestCase):
def __PerformTest(self, type, inputType):
if type.endswith("CLOB"):
longString = u""
else:
longString = ""
directType = getattr(cx_Oracle, type)
self.cursor.exe... | 39.54902 | 75 | 0.529334 |
class TestLobVar(BaseTestCase):
def __PerformTest(self, type, inputType):
if type.endswith("CLOB"):
longString = u""
else:
longString = ""
directType = getattr(cx_Oracle, type)
self.cursor.execute(u"truncate table Test%ss" % type)
for i in ... | true | true |
790cea73f41da9665bff23934f6a6a8608f39f69 | 75 | py | Python | vivit/extensions/secondorder/__init__.py | PwLo3K46/vivit | 937642975be2ade122632d4eaef273461992d7ab | [
"MIT"
] | 7 | 2022-02-11T11:58:46.000Z | 2022-02-15T01:40:36.000Z | vivit/extensions/secondorder/__init__.py | PwLo3K46/vivit | 937642975be2ade122632d4eaef273461992d7ab | [
"MIT"
] | 18 | 2022-02-11T17:37:01.000Z | 2022-03-20T16:46:53.000Z | vivit/extensions/secondorder/__init__.py | PwLo3K46/vivit | 937642975be2ade122632d4eaef273461992d7ab | [
"MIT"
] | 1 | 2022-02-12T10:16:29.000Z | 2022-02-12T10:16:29.000Z | """BackPACK extensions/hooks for computing low-rank factors of the GGN."""
| 37.5 | 74 | 0.76 | true | true | |
790ceae8930692601cf76d087c8e9730cab23cb6 | 2,038 | py | Python | bin/pylama/lint/pylama_pycodestyle.py | ShadowLNC/linter-pylama | 86e6960455f46c099bfd500c859e40c6bd3f9f7e | [
"MIT"
] | 463 | 2015-01-15T08:17:42.000Z | 2022-03-28T15:10:20.000Z | bin/pylama/lint/pylama_pycodestyle.py | ShadowLNC/linter-pylama | 86e6960455f46c099bfd500c859e40c6bd3f9f7e | [
"MIT"
] | 52 | 2015-01-06T02:43:59.000Z | 2022-03-14T11:15:21.000Z | bin/pylama/lint/pylama_pycodestyle.py | ShadowLNC/linter-pylama | 86e6960455f46c099bfd500c859e40c6bd3f9f7e | [
"MIT"
] | 249 | 2015-01-07T22:49:49.000Z | 2022-03-18T02:32:06.000Z | """pycodestyle support."""
from pycodestyle import BaseReport, StyleGuide, get_parser, _parse_multi_options
from pylama.lint import Linter as Abstract
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Linter(Abstract):
"""pycodestyle runner."""
@staticmethod
... | 28.704225 | 80 | 0.597645 | from pycodestyle import BaseReport, StyleGuide, get_parser, _parse_multi_options
from pylama.lint import Linter as Abstract
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Linter(Abstract):
@staticmethod
def run(path, code=None, params=None, **meta):
p... | true | true |
790ceb38bb9c588d34f11ab8bc9e706b2fbb1076 | 982 | py | Python | var/spack/repos/builtin/packages/parsplice/package.py | whitfin/spack | aabd2be31a511d0e00c1017f7311a421659319d9 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2018-08-20T06:55:11.000Z | 2018-08-20T06:55:11.000Z | var/spack/repos/builtin/packages/parsplice/package.py | whitfin/spack | aabd2be31a511d0e00c1017f7311a421659319d9 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2019-04-29T22:36:27.000Z | 2019-04-30T12:51:38.000Z | var/spack/repos/builtin/packages/parsplice/package.py | whitfin/spack | aabd2be31a511d0e00c1017f7311a421659319d9 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1 | 2020-03-12T19:27:17.000Z | 2020-03-12T19:27:17.000Z | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Parsplice(CMakePackage):
"""ParSplice code implements the Parallel Trajectory Splicing al... | 28.882353 | 105 | 0.685336 |
from spack import *
class Parsplice(CMakePackage):
homepage = "https://gitlab.com/exaalt/parsplice"
url = "https://gitlab.com/api/v4/projects/exaalt%2Fparsplice/repository/archive.tar.gz?sha=v1.1"
git = "https://gitlab.com/exaalt/parsplice.git"
tags = ['ecp', 'ecp-apps']
version... | true | true |
790cecfbcb6cea49dc4c4b612ae4395fb990ccb8 | 3,798 | py | Python | tests/test_utils.py | lukerm48/dyc | f7b0a1daf9cdcc4d19bc48cbc4e22c5d5a9b8426 | [
"MIT"
] | null | null | null | tests/test_utils.py | lukerm48/dyc | f7b0a1daf9cdcc4d19bc48cbc4e22c5d5a9b8426 | [
"MIT"
] | null | null | null | tests/test_utils.py | lukerm48/dyc | f7b0a1daf9cdcc4d19bc48cbc4e22c5d5a9b8426 | [
"MIT"
] | null | null | null | from dyc.utils import (
get_leading_whitespace,
read_yaml,
get_indent_forward,
get_indent_backward,
get_extension,
is_comment,
)
class TestGetLeadingWhitespace:
def test_tabs(self):
"""Test tabs functionality"""
text = '\t\tHello'
expected = '\t\t'
got = get... | 29.44186 | 66 | 0.644813 | from dyc.utils import (
get_leading_whitespace,
read_yaml,
get_indent_forward,
get_indent_backward,
get_extension,
is_comment,
)
class TestGetLeadingWhitespace:
def test_tabs(self):
text = '\t\tHello'
expected = '\t\t'
got = get_leading_whitespace(text)
asse... | true | true |
790cee1ca81498cc735ffdeae364a130fd8ac3c8 | 5,714 | py | Python | DIPDenoising/image_reading.py | junyuchen245/SPECT-Img-Denoising-DIP-Keras | 5334c81de364438137a648302b208e58aef82d20 | [
"MIT"
] | 1 | 2020-05-22T02:19:43.000Z | 2020-05-22T02:19:43.000Z | DIPDenoising/image_reading.py | junyuchen245/SPECT-Img-Denoising-DIP-Keras | 5334c81de364438137a648302b208e58aef82d20 | [
"MIT"
] | null | null | null | DIPDenoising/image_reading.py | junyuchen245/SPECT-Img-Denoising-DIP-Keras | 5334c81de364438137a648302b208e58aef82d20 | [
"MIT"
] | 2 | 2020-01-08T06:35:39.000Z | 2021-04-10T08:27:06.000Z | import os
import numpy as np
import warnings
#import SimpleITK as sitk
import cv2
from scipy import misc
from scipy import ndimage
def load_image_from_folder(folder_path, new_size, HE=False, Truc=False, Aug=False):
"""loads images in the folder_path and returns a ndarray and threshold the label image"""
imag... | 41.405797 | 93 | 0.645082 | import os
import numpy as np
import warnings
import cv2
from scipy import misc
from scipy import ndimage
def load_image_from_folder(folder_path, new_size, HE=False, Truc=False, Aug=False):
image_list = []
label_list = []
for image_name in os.listdir(folder_path):
image_original = np.load(fo... | true | true |
790cee37b5bf06c4a4ecbb3615f999d2aaf405ae | 13,157 | py | Python | tensorflow/python/ops/boosted_trees_ops.py | vixadd/tensorflow | 8c624204eb686a91779149dc500e6c8c60096074 | [
"Apache-2.0"
] | 3 | 2019-11-19T14:07:27.000Z | 2020-10-04T12:57:40.000Z | tensorflow/python/ops/boosted_trees_ops.py | vixadd/tensorflow | 8c624204eb686a91779149dc500e6c8c60096074 | [
"Apache-2.0"
] | 4 | 2020-04-09T16:22:20.000Z | 2021-12-15T13:57:36.000Z | tensorflow/python/ops/boosted_trees_ops.py | vixadd/tensorflow | 8c624204eb686a91779149dc500e6c8c60096074 | [
"Apache-2.0"
] | 4 | 2022-01-13T11:23:44.000Z | 2022-03-02T11:11:42.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 42.996732 | 145 | 0.751995 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_boosted_trees_ops
from tensorflow.python.ops import resources
from ... | true | true |
790cefb87f9e42652e95c4ee938b171b4c8bc962 | 268 | py | Python | backend/apps/cabins/migrations/0022_merge_20220210_1705.py | hovedstyret/indok-web | 598e9ca0b5f3a5e776a85dec0a8694b9bcd5a159 | [
"MIT"
] | 3 | 2021-11-18T09:29:14.000Z | 2022-01-13T20:12:11.000Z | backend/apps/cabins/migrations/0022_merge_20220210_1705.py | rubberdok/indok-web | 598e9ca0b5f3a5e776a85dec0a8694b9bcd5a159 | [
"MIT"
] | 277 | 2022-01-17T18:16:44.000Z | 2022-03-31T19:44:04.000Z | backend/apps/cabins/migrations/0022_merge_20220210_1705.py | hovedstyret/indok-web | 598e9ca0b5f3a5e776a85dec0a8694b9bcd5a159 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.11 on 2022-02-10 16:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("cabins", "0020_auto_20211111_1825"),
("cabins", "0021_booking_is_declined"),
]
operations = []
| 19.142857 | 48 | 0.660448 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("cabins", "0020_auto_20211111_1825"),
("cabins", "0021_booking_is_declined"),
]
operations = []
| true | true |
790cefed3568de997b86c088df9e84f65fd2cf7f | 736 | py | Python | plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/actions/mysql/lock.py | a5a351e7/holland | 58a12a5ce10206eed9434ab42b02217de29784bb | [
"BSD-3-Clause"
] | 1 | 2019-06-06T01:07:34.000Z | 2019-06-06T01:07:34.000Z | plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/actions/mysql/lock.py | a5a351e7/holland | 58a12a5ce10206eed9434ab42b02217de29784bb | [
"BSD-3-Clause"
] | null | null | null | plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/actions/mysql/lock.py | a5a351e7/holland | 58a12a5ce10206eed9434ab42b02217de29784bb | [
"BSD-3-Clause"
] | 2 | 2015-12-04T12:17:59.000Z | 2022-03-23T07:22:02.000Z | import logging
LOG = logging.getLogger(__name__)
class FlushAndLockMySQLAction(object):
def __init__(self, client, extra_flush=True):
self.client = client
self.extra_flush = extra_flush
def __call__(self, event, snapshot_fsm, snapshot_vol):
if event == 'pre-snapshot':
if s... | 35.047619 | 63 | 0.634511 | import logging
LOG = logging.getLogger(__name__)
class FlushAndLockMySQLAction(object):
def __init__(self, client, extra_flush=True):
self.client = client
self.extra_flush = extra_flush
def __call__(self, event, snapshot_fsm, snapshot_vol):
if event == 'pre-snapshot':
if s... | true | true |
790cf05b1f2ffc4e39e3da9eee2f324a65bd2ac3 | 6,184 | py | Python | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 1 | 2022-01-25T07:33:18.000Z | 2022-01-25T07:33:18.000Z | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 9 | 2022-03-25T19:35:49.000Z | 2022-03-31T06:09:47.000Z | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 1 | 2022-03-10T22:13:02.000Z | 2022-03-10T22:13:02.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 49.472 | 105 | 0.747413 |
from typing import TYPE_CHECKING
from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
from typing import Any, Optional
from azure.core.credentials import TokenCredential
from ._configuration import DesktopVirtualizationAPIClientConfiguratio... | true | true |
790cf0917728b0fd2c56d1cef1a5a4d45cb2cea1 | 20 | py | Python | tests/__init__.py | noamkatzir/palm-hand-reading | 1a405759c03218fc74d661805bced8e4f4a92e74 | [
"BSD-3-Clause"
] | 5 | 2018-10-21T13:07:36.000Z | 2021-11-26T17:01:47.000Z | tests/__init__.py | noamkatzir/palm-hand-reading | 1a405759c03218fc74d661805bced8e4f4a92e74 | [
"BSD-3-Clause"
] | null | null | null | tests/__init__.py | noamkatzir/palm-hand-reading | 1a405759c03218fc74d661805bced8e4f4a92e74 | [
"BSD-3-Clause"
] | 3 | 2019-06-08T07:04:36.000Z | 2019-11-27T03:12:53.000Z | __author__ = 'noam'
| 10 | 19 | 0.7 | __author__ = 'noam'
| true | true |
790cf1f006df6c4a1016d16f9fc43efc942a64d6 | 5,072 | py | Python | tools/kernelspecs/kernels/R_kubernetes/scripts/launch_kubernetes.py | spotinst/wave-operator | c6cf6ad544b5df98bf80ae640245d309223f99fc | [
"Apache-2.0"
] | null | null | null | tools/kernelspecs/kernels/R_kubernetes/scripts/launch_kubernetes.py | spotinst/wave-operator | c6cf6ad544b5df98bf80ae640245d309223f99fc | [
"Apache-2.0"
] | 9 | 2020-11-17T23:56:26.000Z | 2021-04-26T22:26:29.000Z | tools/kernelspecs/kernels/R_kubernetes/scripts/launch_kubernetes.py | spotinst/wave-operator | c6cf6ad544b5df98bf80ae640245d309223f99fc | [
"Apache-2.0"
] | 1 | 2020-10-22T17:41:17.000Z | 2020-10-22T17:41:17.000Z | import os
import sys
import yaml
import argparse
from kubernetes import client, config
import urllib3
from jinja2 import FileSystemLoader, Environment
urllib3.disable_warnings()
KERNEL_POD_TEMPLATE_PATH = '/kernel-pod.yaml.j2'
def generate_kernel_pod_yaml(keywords):
"""Return the kubernetes pod spec as a yaml ... | 49.242718 | 123 | 0.699921 | import os
import sys
import yaml
import argparse
from kubernetes import client, config
import urllib3
from jinja2 import FileSystemLoader, Environment
urllib3.disable_warnings()
KERNEL_POD_TEMPLATE_PATH = '/kernel-pod.yaml.j2'
def generate_kernel_pod_yaml(keywords):
j_env = Environment(loader=FileSystemLoader(... | true | true |
790cf1fc028c389713a0897411285dc88313b7b0 | 144 | py | Python | src/bot/cocoa/src/basic/sessions/__init__.py | s-akanksha/DialoGraph_ICLR21 | d5bbc10b2623c9f84d21a99a5e54e7dcfdfb1bcc | [
"Apache-2.0"
] | 12 | 2021-03-17T05:15:33.000Z | 2022-01-19T06:09:21.000Z | src/bot/cocoa/src/basic/sessions/__init__.py | s-akanksha/DialoGraph_ICLR21 | d5bbc10b2623c9f84d21a99a5e54e7dcfdfb1bcc | [
"Apache-2.0"
] | 2 | 2021-05-25T07:28:46.000Z | 2022-02-11T01:54:43.000Z | src/bot/cocoa/src/basic/sessions/__init__.py | s-akanksha/DialoGraph_ICLR21 | d5bbc10b2623c9f84d21a99a5e54e7dcfdfb1bcc | [
"Apache-2.0"
] | 4 | 2021-10-11T03:39:38.000Z | 2022-02-01T23:58:50.000Z | __author__ = 'anushabala'
import sys
sys.path.append('/usr1/home/rjoshi2/negotiation_personality/src/negotiation/bot/cocoa/src/basic/sessions')
| 36 | 106 | 0.819444 | __author__ = 'anushabala'
import sys
sys.path.append('/usr1/home/rjoshi2/negotiation_personality/src/negotiation/bot/cocoa/src/basic/sessions')
| true | true |
790cf2e0bcb6b2a4328753d39bb931054a1bdf96 | 5,891 | py | Python | application/workprogramsapp/expertise/views.py | 18ariana/analytics_backend | bfcda70564dd14dadb72de6a70fe2d66790eae85 | [
"MIT"
] | null | null | null | application/workprogramsapp/expertise/views.py | 18ariana/analytics_backend | bfcda70564dd14dadb72de6a70fe2d66790eae85 | [
"MIT"
] | null | null | null | application/workprogramsapp/expertise/views.py | 18ariana/analytics_backend | bfcda70564dd14dadb72de6a70fe2d66790eae85 | [
"MIT"
] | null | null | null | from rest_framework import generics
from rest_framework.exceptions import NotFound
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from workprogramsapp.expertise.models import UserExpertise, ExpertiseComments, Expertise
from workprogramsapp.expertise.serializers import UserE... | 38.253247 | 135 | 0.733831 | from rest_framework import generics
from rest_framework.exceptions import NotFound
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from workprogramsapp.expertise.models import UserExpertise, ExpertiseComments, Expertise
from workprogramsapp.expertise.serializers import UserE... | true | true |
790cf4aaf35e246daa9960fc72e7aa450963d30f | 11,681 | py | Python | fedlearner/trainer/sparse_estimator.py | Hsy-Intel/fedlearner | d5d0bb5549e115eaf0dec5a00a78dcb21ac0909d | [
"Apache-2.0"
] | 772 | 2020-01-21T13:59:42.000Z | 2022-03-30T08:20:16.000Z | fedlearner/trainer/sparse_estimator.py | Hsy-Intel/fedlearner | d5d0bb5549e115eaf0dec5a00a78dcb21ac0909d | [
"Apache-2.0"
] | 126 | 2020-03-03T07:54:39.000Z | 2022-03-08T23:24:03.000Z | fedlearner/trainer/sparse_estimator.py | Hsy-Intel/fedlearner | d5d0bb5549e115eaf0dec5a00a78dcb21ac0909d | [
"Apache-2.0"
] | 198 | 2020-01-22T02:16:17.000Z | 2022-03-31T01:13:05.000Z | # Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.559028 | 80 | 0.606712 |
import tensorflow.compat.v1 as tf
from tensorflow.contrib import graph_editor as ge
from fedlearner.trainer import embedding
from fedlearner.trainer import estimator
from fedlearner.trainer import feature
from fedlearner.trainer import operator
from fedlearner.trainer import utils
class ConfigRunErr... | true | true |
790cf563324939c7d34424931157221f1225e53d | 473 | py | Python | sphinx/source/docs/first_steps/examples/first_steps_4_background.py | g-parki/bokeh | 664ead5306bba64609e734d4105c8aa8cfb76d81 | [
"BSD-3-Clause"
] | 15,193 | 2015-01-01T05:11:45.000Z | 2022-03-31T19:30:20.000Z | sphinx/source/docs/first_steps/examples/first_steps_4_background.py | g-parki/bokeh | 664ead5306bba64609e734d4105c8aa8cfb76d81 | [
"BSD-3-Clause"
] | 9,554 | 2015-01-01T03:16:54.000Z | 2022-03-31T22:59:39.000Z | sphinx/source/docs/first_steps/examples/first_steps_4_background.py | g-parki/bokeh | 664ead5306bba64609e734d4105c8aa8cfb76d81 | [
"BSD-3-Clause"
] | 4,829 | 2015-01-02T03:35:32.000Z | 2022-03-30T16:40:26.000Z | from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [4, 5, 5, 7, 2]
# create a plot
p = figure(
title="Background colors example",
sizing_mode="stretch_width",
max_width=500,
height=250,
)
# add a renderer
p.line(x, y, line_color="green", line_width=2)
# change the fi... | 18.92 | 46 | 0.668076 | from bokeh.plotting import figure, show
x = [1, 2, 3, 4, 5]
y = [4, 5, 5, 7, 2]
p = figure(
title="Background colors example",
sizing_mode="stretch_width",
max_width=500,
height=250,
)
p.line(x, y, line_color="green", line_width=2)
p.background_fill_color = (204, 255, 255)
p.border_fill_color = ... | true | true |
790cf7caeb741e9e1c22fc1370b58849da1405f3 | 3,902 | py | Python | python/init.py | ur4ltz/ollypython | 0193c64892c19ca5ada2545f1a63560d4dbc1360 | [
"BSD-3-Clause"
] | null | null | null | python/init.py | ur4ltz/ollypython | 0193c64892c19ca5ada2545f1a63560d4dbc1360 | [
"BSD-3-Clause"
] | null | null | null | python/init.py | ur4ltz/ollypython | 0193c64892c19ca5ada2545f1a63560d4dbc1360 | [
"BSD-3-Clause"
] | 1 | 2016-11-14T14:11:42.000Z | 2016-11-14T14:11:42.000Z | import os
import sys
import time
import _ollyapi
def addscriptpath(script):
"""
Add the path part of the scriptfile to the system path to
allow modules to be loaded from the same place.
Each path is added only once.
"""
pathfound = 0
scriptpath = os.path.dirname(script)
... | 28.071942 | 127 | 0.563557 | import os
import sys
import time
import _ollyapi
def addscriptpath(script):
pathfound = 0
scriptpath = os.path.dirname(script)
for pathitem in sys.path:
if pathitem == scriptpath:
pathfound = 1
break
if pathfound == 0:
sys.path.append(scr... | true | true |
790cf84f46eb94506d78b0f795b48648a2f8c55e | 19,575 | py | Python | IntOpt/shortespath/shortespath.py | Patyrn/Divide-and-Learn | ff03689c7ab6a7155ebd019babce8f79d0757a53 | [
"MIT"
] | 7 | 2020-11-06T01:29:48.000Z | 2022-01-02T12:49:40.000Z | IntOpt/shortespath/shortespath.py | Patyrn/Divide-and-Learn | ff03689c7ab6a7155ebd019babce8f79d0757a53 | [
"MIT"
] | 2 | 2021-01-19T16:59:04.000Z | 2021-01-25T10:17:46.000Z | IntOpt/shortespath/shortespath.py | Patyrn/Divide-and-Learn | ff03689c7ab6a7155ebd019babce8f79d0757a53 | [
"MIT"
] | 5 | 2021-07-13T04:47:13.000Z | 2022-01-17T14:05:06.000Z | import torch
from torch import nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import random
import numpy as np
import scipy as sp
import gurobipy as gp
from qpthlocal.qp import QPFunction
from qpthlocal.qp import QPSolvers
from qpthlocal.qp import make_gurobi_model
import... | 34.463028 | 101 | 0.678161 | import torch
from torch import nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import random
import numpy as np
import scipy as sp
import gurobipy as gp
from qpthlocal.qp import QPFunction
from qpthlocal.qp import QPSolvers
from qpthlocal.qp import make_gurobi_model
import... | true | true |
790cf8aa27b10f4715d6d4ea418e882eee85a64e | 11,748 | py | Python | src/dapt_pretraining.py | TysonYu/AdaptSum | a4f17060e7a8e6f9b86d33a930804445e4226ba4 | [
"CC-BY-4.0"
] | 29 | 2021-03-18T03:43:27.000Z | 2022-03-23T02:13:46.000Z | src/dapt_pretraining.py | TysonYu/AdaptSum | a4f17060e7a8e6f9b86d33a930804445e4226ba4 | [
"CC-BY-4.0"
] | 4 | 2021-04-17T13:33:29.000Z | 2021-12-13T13:52:45.000Z | src/dapt_pretraining.py | TysonYu/AdaptSum | a4f17060e7a8e6f9b86d33a930804445e4226ba4 | [
"CC-BY-4.0"
] | 1 | 2021-06-07T08:30:35.000Z | 2021-06-07T08:30:35.000Z |
import torch
from torch.utils.data import Dataset, DataLoader
from transformers import BartForConditionalGeneration, BartTokenizer, get_linear_schedule_with_warmup
from others.logging import logger
from others.utils import pad_sents, get_mask
from others.optimizer import build_optim
from tqdm import tqdm
import numpy ... | 44.165414 | 190 | 0.636279 |
import torch
from torch.utils.data import Dataset, DataLoader
from transformers import BartForConditionalGeneration, BartTokenizer, get_linear_schedule_with_warmup
from others.logging import logger
from others.utils import pad_sents, get_mask
from others.optimizer import build_optim
from tqdm import tqdm
import numpy ... | true | true |
790cf9193aabd5c8184321cab368b4311e4b7f54 | 786 | py | Python | ao2j/lt1300/055/A.py | neshdev/competitive-prog | f406a85d62e83c3dbd3ad41f42ae121ebefd0fda | [
"MIT"
] | null | null | null | ao2j/lt1300/055/A.py | neshdev/competitive-prog | f406a85d62e83c3dbd3ad41f42ae121ebefd0fda | [
"MIT"
] | null | null | null | ao2j/lt1300/055/A.py | neshdev/competitive-prog | f406a85d62e83c3dbd3ad41f42ae121ebefd0fda | [
"MIT"
] | null | null | null | n = int(input())
arr = [[None for i in range(2*n+1)]for i in range(2*n+1)]
m = (2*n + 1) // 2
for i in range(n):
arr[i][m] = i
arr[n][m] = n
for i in range(n+1,2*n+1):
arr[i][m] = arr[i-1][m]-1
for y in range(1,m+1):
for x in range(len(arr[0])):
if x < m:
arr[y][x] = arr[y-1][x+1]
... | 21.833333 | 57 | 0.431298 | n = int(input())
arr = [[None for i in range(2*n+1)]for i in range(2*n+1)]
m = (2*n + 1) // 2
for i in range(n):
arr[i][m] = i
arr[n][m] = n
for i in range(n+1,2*n+1):
arr[i][m] = arr[i-1][m]-1
for y in range(1,m+1):
for x in range(len(arr[0])):
if x < m:
arr[y][x] = arr[y-1][x+1]
... | true | true |
790cf9506ce83c39688251073c3a5cd139466739 | 3,278 | py | Python | pyRoutines/angle_transformation.py | aasensio/hazel | 899c8461324061bacc14da7165b9ac7eed35c96b | [
"MIT"
] | 6 | 2016-01-11T05:03:00.000Z | 2018-08-31T11:13:24.000Z | pyRoutines/angle_transformation.py | aasensio/hazel | 899c8461324061bacc14da7165b9ac7eed35c96b | [
"MIT"
] | 12 | 2017-04-22T16:10:43.000Z | 2021-01-11T14:03:59.000Z | pyRoutines/angle_transformation.py | aasensio/hazel | 899c8461324061bacc14da7165b9ac7eed35c96b | [
"MIT"
] | 4 | 2016-02-25T19:35:07.000Z | 2018-10-01T17:12:52.000Z | # cdiazbas@iac.es
import numpy as np
# Return the angles in the plane of the sky given angles with respect
# to the vertical for observations on the limb (in degrees!)
def absolute_to_sky(thetaB, chiB):
thetaB = np.deg2rad(thetaB)
chiB = np.deg2rad(chiB)
t1 = np.sin(thetaB) * np.sin(chiB)
t2 = -np.co... | 28.754386 | 69 | 0.655583 |
import numpy as np
def absolute_to_sky(thetaB, chiB):
thetaB = np.deg2rad(thetaB)
chiB = np.deg2rad(chiB)
t1 = np.sin(thetaB) * np.sin(chiB)
t2 = -np.cos(thetaB)
t3 = np.sin(thetaB) * np.cos(chiB)
thetaSky = np.arccos(t3)
sinthSky = np.sqrt(1.e0 - t3**2)
sinChiSky = t1 / sinthSky... | true | true |
790cf99896e3378cf4d5dfe9ee9b7a79e978e407 | 520 | py | Python | 14.py | profamaroca/Lista3-1 | 4a90d9d5293cd823b0da8dbb618668a6e4455910 | [
"Unlicense"
] | null | null | null | 14.py | profamaroca/Lista3-1 | 4a90d9d5293cd823b0da8dbb618668a6e4455910 | [
"Unlicense"
] | null | null | null | 14.py | profamaroca/Lista3-1 | 4a90d9d5293cd823b0da8dbb618668a6e4455910 | [
"Unlicense"
] | null | null | null | import math
numero_turmas = int(input('Qual o número de turmas? '))
for _ in range(numero_turmas):
numero_alunos = int(input('Qual o número de alunos? '))
soma = 0
menor = math.inf
maior = 0
for i in range(numero_alunos):
nota = float(input(f'Qual a nota do aluno {i + 1}? '))
soma +=... | 30.588235 | 92 | 0.578846 | import math
numero_turmas = int(input('Qual o número de turmas? '))
for _ in range(numero_turmas):
numero_alunos = int(input('Qual o número de alunos? '))
soma = 0
menor = math.inf
maior = 0
for i in range(numero_alunos):
nota = float(input(f'Qual a nota do aluno {i + 1}? '))
soma +=... | true | true |
790cf9adae4bc44bf1f478eb7dbd3d59a8f174ea | 1,346 | py | Python | saleor/graphql/shop/schema.py | fooliscool/saleor | 9502467c0e745eb8afdbfa373d634814d133e864 | [
"CC-BY-4.0"
] | 1 | 2020-11-13T14:25:51.000Z | 2020-11-13T14:25:51.000Z | saleor/graphql/shop/schema.py | fooliscool/saleor | 9502467c0e745eb8afdbfa373d634814d133e864 | [
"CC-BY-4.0"
] | 51 | 2019-12-06T08:06:07.000Z | 2021-05-06T02:10:50.000Z | saleor/graphql/shop/schema.py | jnbao2020/saleor | e1773b42a8ecd78114cf4485d553b09469b5f1f8 | [
"CC-BY-4.0"
] | null | null | null | import graphene
from ..translations.mutations import ShopSettingsTranslate
from .mutations import (
AuthorizationKeyAdd,
AuthorizationKeyDelete,
HomepageCollectionUpdate,
ShopAddressUpdate,
ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
StaffNotificationRecipientCreate,
St... | 33.65 | 82 | 0.801634 | import graphene
from ..translations.mutations import ShopSettingsTranslate
from .mutations import (
AuthorizationKeyAdd,
AuthorizationKeyDelete,
HomepageCollectionUpdate,
ShopAddressUpdate,
ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
StaffNotificationRecipientCreate,
St... | true | true |
790cfadbb88ba354a6a5c3ad91a35f82094de4d4 | 10,763 | py | Python | generate_plabel_dark_zurich.py | qimw/UACDA | 75d8d03786cba009f56cdb1efd2d6d5abe0c5f77 | [
"MIT"
] | 7 | 2021-03-08T04:28:55.000Z | 2021-04-29T04:55:11.000Z | generate_plabel_dark_zurich.py | qimw/UACDA | 75d8d03786cba009f56cdb1efd2d6d5abe0c5f77 | [
"MIT"
] | null | null | null | generate_plabel_dark_zurich.py | qimw/UACDA | 75d8d03786cba009f56cdb1efd2d6d5abe0c5f77 | [
"MIT"
] | null | null | null | import argparse
import scipy
from scipy import ndimage
import numpy as np
import sys
import re
from packaging import version
import torch
from torch.autograd import Variable
import torchvision.models as models
import torch.nn.functional as F
from torch.utils import data, model_zoo
from model.deeplab import Res_Deeplab... | 42.207843 | 231 | 0.632816 | import argparse
import scipy
from scipy import ndimage
import numpy as np
import sys
import re
from packaging import version
import torch
from torch.autograd import Variable
import torchvision.models as models
import torch.nn.functional as F
from torch.utils import data, model_zoo
from model.deeplab import Res_Deeplab... | true | true |
790cfc197cc05559af2afb829af887577346f90f | 2,352 | py | Python | model/classifier.py | haifangong/TNSC-classification-baseline | 2fb8696699b44fbeb0512fd60deda792b464a958 | [
"MIT"
] | 10 | 2020-07-31T14:24:26.000Z | 2021-08-20T05:34:11.000Z | model/classifier.py | haifangong/TNSC-classification-baseline | 2fb8696699b44fbeb0512fd60deda792b464a958 | [
"MIT"
] | null | null | null | model/classifier.py | haifangong/TNSC-classification-baseline | 2fb8696699b44fbeb0512fd60deda792b464a958 | [
"MIT"
] | null | null | null | import torch
from torch import nn
from torch.nn import init
import torch.nn.functional as F
class SCNN(nn.Module):
def __init__(self, in_channels, n_classes):
super(SCNN, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels, out_channels=16, kernel_size=3),
nn... | 30.153846 | 67 | 0.519983 | import torch
from torch import nn
from torch.nn import init
import torch.nn.functional as F
class SCNN(nn.Module):
def __init__(self, in_channels, n_classes):
super(SCNN, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels, out_channels=16, kernel_size=3),
nn... | true | true |
790cfce881c85684705a873733f42fcdf6cb74cd | 792 | py | Python | app_util.py | Bhaskers-Blu-Org1/long-way-home-callforcode | 81cc683f4b2e86f3d3afaafb8b2ced915707ea2b | [
"Apache-2.0"
] | 6 | 2019-07-29T06:16:35.000Z | 2021-11-08T09:34:00.000Z | app_util.py | Bhaskers-Blu-Org1/long-way-home-callforcode | 81cc683f4b2e86f3d3afaafb8b2ced915707ea2b | [
"Apache-2.0"
] | 15 | 2019-08-27T09:57:58.000Z | 2022-02-26T10:52:55.000Z | app_util.py | IBM/long-way-home-callforcode | 7a86266d33c67f84b6e471912a3710d7db0bec6f | [
"Apache-2.0"
] | 2 | 2019-11-02T08:54:00.000Z | 2020-06-29T14:30:31.000Z | from flask import g
import logging
from datetime import datetime
import config
def get_logger(name):
# type: (str) -> logging.Logger
logging.basicConfig()
logger = logging.getLogger(name)
logger.setLevel(config.GLOBAL_LOGGING_LEVEL)
ch = logging.StreamHandler()
ch.setLevel(config.GLOBAL_LOGGING_LEVEL)
fo... | 26.4 | 87 | 0.715909 | from flask import g
import logging
from datetime import datetime
import config
def get_logger(name):
logging.basicConfig()
logger = logging.getLogger(name)
logger.setLevel(config.GLOBAL_LOGGING_LEVEL)
ch = logging.StreamHandler()
ch.setLevel(config.GLOBAL_LOGGING_LEVEL)
formatter = logging.Formatter('%(... | true | true |
790cfd31a2cc573ec974c74a888c2263a3fdae84 | 2,275 | py | Python | aiida/storage/psql_dos/migrations/versions/django_0009_base_data_plugin_type_string.py | mkrack/aiida-core | bab1ad6cfc8e4ff041bce268f9270c613663cb35 | [
"MIT",
"BSD-3-Clause"
] | 153 | 2016-12-23T20:59:03.000Z | 2019-07-02T06:47:52.000Z | aiida/storage/psql_dos/migrations/versions/django_0009_base_data_plugin_type_string.py | mkrack/aiida-core | bab1ad6cfc8e4ff041bce268f9270c613663cb35 | [
"MIT",
"BSD-3-Clause"
] | 2,466 | 2016-12-24T01:03:52.000Z | 2019-07-04T13:41:08.000Z | aiida/storage/psql_dos/migrations/versions/django_0009_base_data_plugin_type_string.py | mkrack/aiida-core | bab1ad6cfc8e4ff041bce268f9270c613663cb35 | [
"MIT",
"BSD-3-Clause"
] | 88 | 2016-12-23T16:28:00.000Z | 2019-07-01T15:55:20.000Z | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 42.924528 | 103 | 0.566154 | true | true | |
790cfdb12440dec3a0e2fe3bf2b9299b4a29c812 | 7 | py | Python | examples/py33-0012-uprefix1.py | jwilk-forks/python-grammar-changes | 5cbc14e520fadfef8539760a4ffdbe14b9d02f39 | [
"MIT"
] | 8 | 2020-11-21T22:39:41.000Z | 2022-03-13T18:45:53.000Z | examples/py33-0012-uprefix1.py | jwilk-forks/python-grammar-changes | 5cbc14e520fadfef8539760a4ffdbe14b9d02f39 | [
"MIT"
] | 1 | 2021-12-10T10:45:38.000Z | 2021-12-10T10:45:38.000Z | examples/py33-0012-uprefix1.py | jwilk-forks/python-grammar-changes | 5cbc14e520fadfef8539760a4ffdbe14b9d02f39 | [
"MIT"
] | 1 | 2022-02-07T11:16:38.000Z | 2022-02-07T11:16:38.000Z | u"foo"
| 3.5 | 6 | 0.571429 | true | true | |
790cfdf50546893f5f06d536c2cf418c85d0d312 | 12,326 | py | Python | noxfile.py | texnofobix/python-genbadge | 67ec6b5031a57a0b577bee5c1111437ef1037130 | [
"BSD-3-Clause"
] | null | null | null | noxfile.py | texnofobix/python-genbadge | 67ec6b5031a57a0b577bee5c1111437ef1037130 | [
"BSD-3-Clause"
] | null | null | null | noxfile.py | texnofobix/python-genbadge | 67ec6b5031a57a0b577bee5c1111437ef1037130 | [
"BSD-3-Clause"
] | null | null | null | from itertools import product
from json import dumps
import logging
import nox # noqa
from pathlib import Path # noqa
import sys
# add parent folder to python path so that we can import noxfile_utils.py
# note that you need to "pip install -r noxfile-requiterements.txt" for this file to work.
sys.path.append(str(P... | 44.498195 | 120 | 0.682865 | from itertools import product
from json import dumps
import logging
import nox
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).parent / "ci_tools"))
from nox_utils import PY27, PY37, PY36, PY35, PY38, PY39, power_session, rm_folder, rm_file, PowerSession
pkg_name = "genbadge"
gh_org ... | true | true |
790cfe04b88f499e32acf9459348ea860c18fcc7 | 559 | py | Python | Haberman Data/deal_data.py | hrsu/disturb | 38396fceb6c7b11fbc369166c7eea048c4188391 | [
"Apache-2.0"
] | 1 | 2019-02-27T06:45:11.000Z | 2019-02-27T06:45:11.000Z | Haberman Data/deal_data.py | hrsu/disturb | 38396fceb6c7b11fbc369166c7eea048c4188391 | [
"Apache-2.0"
] | null | null | null | Haberman Data/deal_data.py | hrsu/disturb | 38396fceb6c7b11fbc369166c7eea048c4188391 | [
"Apache-2.0"
] | null | null | null | def deal(infilename,outfilename):
infile = open(infilename)
lines = infile.readlines()
out = []
for line in lines:
line = line.split(',')
val = line[-1][0]
line = line[:-1]
line.insert(0,val)
out.append(line)
print(out)
str = ''
for line in out:
... | 27.95 | 52 | 0.545617 | def deal(infilename,outfilename):
infile = open(infilename)
lines = infile.readlines()
out = []
for line in lines:
line = line.split(',')
val = line[-1][0]
line = line[:-1]
line.insert(0,val)
out.append(line)
print(out)
str = ''
for line in out:
... | true | true |
790cfe747d847095ab3a279b418644d134d9ace5 | 1,024 | py | Python | main.py | a892574222/game | db1ca156a8fbf77019bc05b8137c928c1a907ec0 | [
"Apache-2.0"
] | null | null | null | main.py | a892574222/game | db1ca156a8fbf77019bc05b8137c928c1a907ec0 | [
"Apache-2.0"
] | null | null | null | main.py | a892574222/game | db1ca156a8fbf77019bc05b8137c928c1a907ec0 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
from src.tk import TK
import argparse
parser = argparse.ArgumentParser()
parser.register('type', 'bool', (lambda x: x.lower() in ('True', "yes", "true", "t", "1")))
parser.add_argument('--mode', default='main', help='')
args = parser.parse_args()
if args.mode == 'main':
window = TK()
window.st... | 21.333333 | 91 | 0.586914 |
from src.tk import TK
import argparse
parser = argparse.ArgumentParser()
parser.register('type', 'bool', (lambda x: x.lower() in ('True', "yes", "true", "t", "1")))
parser.add_argument('--mode', default='main', help='')
args = parser.parse_args()
if args.mode == 'main':
window = TK()
window.start()
elif arg... | true | true |
790cff7f1379496b3b9251e03735a67ac4f27f85 | 1,956 | py | Python | src/load.py | philkr/voc-classification | c2097796951ea49eb4f7a919a4091b25b3ae2b52 | [
"BSD-2-Clause"
] | 55 | 2016-08-14T19:09:59.000Z | 2021-11-30T01:27:51.000Z | src/load.py | jeffdonahue/voc-classification | 585dbcaeae8d30503c4b7781e2a1ee3f57067c30 | [
"BSD-2-Clause"
] | 8 | 2016-07-27T00:29:55.000Z | 2018-12-29T05:38:34.000Z | src/load.py | philkr/voc-classification | c2097796951ea49eb4f7a919a4091b25b3ae2b52 | [
"BSD-2-Clause"
] | 20 | 2016-08-01T02:50:51.000Z | 2020-08-24T01:34:54.000Z | from caffe_all import *
def parseProtoString(s):
from google.protobuf import text_format
proto_net = pb.NetParameter()
text_format.Merge(s, proto_net)
return proto_net
def get_param(l, exclude=set(['top', 'bottom', 'name', 'type'])):
if not hasattr(l,'ListFields'):
if hasattr(l,'__delitem... | 34.315789 | 77 | 0.506646 | from caffe_all import *
def parseProtoString(s):
from google.protobuf import text_format
proto_net = pb.NetParameter()
text_format.Merge(s, proto_net)
return proto_net
def get_param(l, exclude=set(['top', 'bottom', 'name', 'type'])):
if not hasattr(l,'ListFields'):
if hasattr(l,'__delitem... | true | true |
790cff95827fc7d17d1cd74f5ffe045e5f4ccfd9 | 46,520 | py | Python | pandas/io/formats/style.py | harunpehlivan/pandas | 2e38d5552a5c7b2c0091cecddd483f4f08ad1d2c | [
"BSD-3-Clause"
] | 1 | 2021-02-18T00:32:20.000Z | 2021-02-18T00:32:20.000Z | pandas/io/formats/style.py | DeanLa/pandas | 09633b868f2f999599e29d32a326e112fdbbf3ec | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/io/formats/style.py | DeanLa/pandas | 09633b868f2f999599e29d32a326e112fdbbf3ec | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | """
Module for applying conditional formatting to
DataFrames and Series.
"""
from collections import defaultdict
from contextlib import contextmanager
import copy
from functools import partial
from itertools import product
from uuid import uuid1
import numpy as np
from pandas.compat import range
from pandas.util._de... | 34.005848 | 79 | 0.529923 |
from collections import defaultdict
from contextlib import contextmanager
import copy
from functools import partial
from itertools import product
from uuid import uuid1
import numpy as np
from pandas.compat import range
from pandas.util._decorators import Appender
from pandas.core.dtypes.common import is_float, is_... | true | true |
790d00344232a574dc3e54ad2b287f0f6c4410d6 | 770 | py | Python | palimport/_utils.py | asmodehn/lark_import | f98fc66e786c5ad9894fc75ad7cc2857702994fe | [
"MIT"
] | 2 | 2019-09-19T14:28:04.000Z | 2021-09-27T09:26:27.000Z | palimport/_utils.py | asmodehn/lark_import | f98fc66e786c5ad9894fc75ad7cc2857702994fe | [
"MIT"
] | 3 | 2018-05-15T07:54:39.000Z | 2018-05-29T07:51:20.000Z | palimport/_utils.py | asmodehn/palimport | f98fc66e786c5ad9894fc75ad7cc2857702994fe | [
"MIT"
] | null | null | null | from __future__ import absolute_import, print_function
import sys
def _verbose_message(message, *args, **kwargs):
"""Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
verbosity = kwargs.pop('verbosity', 1)
if sys.flags.verbose >= verbosity:
if not message.startswith(('#', 'import '... | 30.8 | 71 | 0.637662 | from __future__ import absolute_import, print_function
import sys
def _verbose_message(message, *args, **kwargs):
verbosity = kwargs.pop('verbosity', 1)
if sys.flags.verbose >= verbosity:
if not message.startswith(('#', 'import ')):
message = '# ' + message
print(message.format(*a... | true | true |
790d0034e77697b07ad94204308782dff8c27267 | 6,439 | py | Python | plenum/server/view_change/pre_view_change_strategies.py | andkononykhin/indy-plenum-copy | 46c48feaf75e5578c9dceb76d4b6d09f7e63add5 | [
"Apache-2.0"
] | 1 | 2019-03-19T23:44:56.000Z | 2019-03-19T23:44:56.000Z | plenum/server/view_change/pre_view_change_strategies.py | andkononykhin/indy-plenum-copy | 46c48feaf75e5578c9dceb76d4b6d09f7e63add5 | [
"Apache-2.0"
] | null | null | null | plenum/server/view_change/pre_view_change_strategies.py | andkononykhin/indy-plenum-copy | 46c48feaf75e5578c9dceb76d4b6d09f7e63add5 | [
"Apache-2.0"
] | null | null | null | from abc import abstractmethod, ABCMeta
from collections import deque
from functools import partial
from plenum.common.constants import VIEW_CHANGE_START, PreVCStrategies, VIEW_CHANGE_CONTINUE
from plenum.common.messages.node_messages import ViewChangeStartMessage, ViewChangeContinueMessage, PrePrepare, Prepare, \
... | 44.715278 | 131 | 0.701196 | from abc import abstractmethod, ABCMeta
from collections import deque
from functools import partial
from plenum.common.constants import VIEW_CHANGE_START, PreVCStrategies, VIEW_CHANGE_CONTINUE
from plenum.common.messages.node_messages import ViewChangeStartMessage, ViewChangeContinueMessage, PrePrepare, Prepare, \
... | true | true |
790d007368ae40c90ca3ead37878146b24ec5ed8 | 3,037 | py | Python | contrib/linearize/linearize-hashes.py | listedlinked/sors | 99992f4acdcdbeb30e707cb67697dcc9bdd0db73 | [
"MIT"
] | null | null | null | contrib/linearize/linearize-hashes.py | listedlinked/sors | 99992f4acdcdbeb30e707cb67697dcc9bdd0db73 | [
"MIT"
] | null | null | null | contrib/linearize/linearize-hashes.py | listedlinked/sors | 99992f4acdcdbeb30e707cb67697dcc9bdd0db73 | [
"MIT"
] | null | null | null | #!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import pri... | 26.640351 | 90 | 0.682581 |
from __future__ import print_function
import json
import struct
import re
import base64
import httplib
import sys
settings = {}
class BitcoinRPC:
def __init__(self, host, port, username, password):
authpair = "%s:%s" % (username, password)
self.authhdr = "Basic %s" % (base64.b64encode(authpair))
self.... | true | true |
790d008f566269ced30d6bdcef22ad14cf2617a5 | 3,979 | py | Python | pywick/optimizers/ralamb.py | achaiah/pywick | 9d663faf0c1660a9b8359a6472c164f658dfc8cb | [
"MIT"
] | 408 | 2019-05-16T16:12:41.000Z | 2022-03-26T17:27:12.000Z | pywick/optimizers/ralamb.py | achaiah/pywick | 9d663faf0c1660a9b8359a6472c164f658dfc8cb | [
"MIT"
] | 13 | 2019-05-17T05:47:06.000Z | 2021-06-21T19:02:30.000Z | pywick/optimizers/ralamb.py | achaiah/pywick | 9d663faf0c1660a9b8359a6472c164f658dfc8cb | [
"MIT"
] | 42 | 2019-05-16T19:57:12.000Z | 2022-03-06T15:23:18.000Z | # Source: https://gist.github.com/redknightlois/c4023d393eb8f92bb44b2ab582d7ec20
from torch.optim.optimizer import Optimizer
import torch
import math
class Ralamb(Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=1e-4):
defaults = dict(lr=lr, betas=betas, eps=eps... | 40.191919 | 195 | 0.508922 |
from torch.optim.optimizer import Optimizer
import torch
import math
class Ralamb(Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=1e-4):
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay)
self.buffer = [[None, None, None] for ind i... | true | true |
790d00c5a223d8b8edeefd87b662eb702c908c85 | 792 | py | Python | package/config.py | sooftware/char-rnnlm | fc6573bde13b151f373fc081f63e3f563debf56c | [
"MIT"
] | 7 | 2020-04-16T17:37:56.000Z | 2022-02-02T11:00:30.000Z | package/config.py | sooftware/char-rnnlm | fc6573bde13b151f373fc081f63e3f563debf56c | [
"MIT"
] | null | null | null | package/config.py | sooftware/char-rnnlm | fc6573bde13b151f373fc081f63e3f563debf56c | [
"MIT"
] | 3 | 2020-04-16T17:39:19.000Z | 2020-12-28T03:45:04.000Z | class Config:
def __init__(self,
use_cuda=True,
hidden_size=512,
dropout_p=0.5,
n_layers=4,
batch_size=32,
max_epochs=40,
lr=0.0001,
teacher_forcing_ratio=1.0,
see... | 30.461538 | 58 | 0.5 | class Config:
def __init__(self,
use_cuda=True,
hidden_size=512,
dropout_p=0.5,
n_layers=4,
batch_size=32,
max_epochs=40,
lr=0.0001,
teacher_forcing_ratio=1.0,
see... | true | true |
790d02420ad1f5d3448692d666d225f8f191208a | 1,533 | py | Python | hacking/checks/dictlist.py | UbuntuEvangelist/hacking | c1bf3fa5a2122e0d2b83ac47ec2861387d06a8c3 | [
"Apache-2.0"
] | 1 | 2016-04-29T17:33:40.000Z | 2016-04-29T17:33:40.000Z | hacking/checks/dictlist.py | UbuntuEvangelist/hacking | c1bf3fa5a2122e0d2b83ac47ec2861387d06a8c3 | [
"Apache-2.0"
] | null | null | null | hacking/checks/dictlist.py | UbuntuEvangelist/hacking | c1bf3fa5a2122e0d2b83ac47ec2861387d06a8c3 | [
"Apache-2.0"
] | 16 | 2017-01-12T09:38:55.000Z | 2019-04-18T20:52:34.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | 32.617021 | 76 | 0.643183 |
import tokenize
from hacking import core
LOCALS_TEXT_MAP = {
'locals': 'locals()',
'self': 'self.__dict__'
}
@core.flake8ext
def hacking_no_locals(logical_line, physical_line, tokens, noqa):
if noqa:
return
for_formatting = False
for token_type, text, start, _, _ in tokens:
... | true | true |
790d029148e060461c2ca87346f345b09776d25b | 405 | py | Python | __init__.py | rogermoore6872/mycroft-fortune | 23e1c82fbb8c4b24553c419b82c57fd9c15d19ae | [
"MIT"
] | null | null | null | __init__.py | rogermoore6872/mycroft-fortune | 23e1c82fbb8c4b24553c419b82c57fd9c15d19ae | [
"MIT"
] | null | null | null | __init__.py | rogermoore6872/mycroft-fortune | 23e1c82fbb8c4b24553c419b82c57fd9c15d19ae | [
"MIT"
] | null | null | null | from mycroft import MycroftSkill, intent_file_handler
import subprocess
class Fortune(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('fortune.intent')
def handle_fortune(self, message):
result = subprocess.run("fortune", capture_output=True, text=True)
... | 23.823529 | 74 | 0.728395 | from mycroft import MycroftSkill, intent_file_handler
import subprocess
class Fortune(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('fortune.intent')
def handle_fortune(self, message):
result = subprocess.run("fortune", capture_output=True, text=True)
... | true | true |
790d03197ad47b0b968b011b5824f33a34bbd869 | 418 | py | Python | colaboradados_django/wsgi.py | dennys-bd/colaboradados_django | 0c2b78e670924fd5ac094598bfad2c81a86cf74f | [
"MIT"
] | null | null | null | colaboradados_django/wsgi.py | dennys-bd/colaboradados_django | 0c2b78e670924fd5ac094598bfad2c81a86cf74f | [
"MIT"
] | null | null | null | colaboradados_django/wsgi.py | dennys-bd/colaboradados_django | 0c2b78e670924fd5ac094598bfad2c81a86cf74f | [
"MIT"
] | null | null | null | """
WSGI config for colaboradados_django project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault... | 23.222222 | 80 | 0.796651 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'colaboradados_django.settings')
application = get_wsgi_application()
| true | true |
790d036d225b557e23d8e46233e190899240bc79 | 163 | py | Python | bin/cubes/pentacubes-stepped-pyramid-5.py | tiwo/puzzler | 7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e | [
"Intel"
] | null | null | null | bin/cubes/pentacubes-stepped-pyramid-5.py | tiwo/puzzler | 7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e | [
"Intel"
] | null | null | null | bin/cubes/pentacubes-stepped-pyramid-5.py | tiwo/puzzler | 7ad3d9a792f0635f7ec59ffa85fb46b54fd77a7e | [
"Intel"
] | 1 | 2022-01-02T16:54:14.000Z | 2022-01-02T16:54:14.000Z | #!/usr/bin/env python
# $Id$
"""many solutions"""
import puzzler
from puzzler.puzzles.pentacubes import PentacubesSteppedPyramid5 as puzzle
puzzler.run(puzzle)
| 16.3 | 74 | 0.773006 |
import puzzler
from puzzler.puzzles.pentacubes import PentacubesSteppedPyramid5 as puzzle
puzzler.run(puzzle)
| true | true |
790d0373d580aadbe327fd158a968804bbfd2262 | 2,074 | py | Python | ml_from_scratch/logistic_regression.py | peimengsui/ml_from_scratch | 5f5d276fee8f25ab91fd4342434aa23eb154a405 | [
"MIT"
] | null | null | null | ml_from_scratch/logistic_regression.py | peimengsui/ml_from_scratch | 5f5d276fee8f25ab91fd4342434aa23eb154a405 | [
"MIT"
] | null | null | null | ml_from_scratch/logistic_regression.py | peimengsui/ml_from_scratch | 5f5d276fee8f25ab91fd4342434aa23eb154a405 | [
"MIT"
] | 1 | 2020-08-09T19:39:27.000Z | 2020-08-09T19:39:27.000Z | import numpy as np
import math
from ml_from_scratch.activation_functions import Sigmoid
from ml_from_scratch.utils import make_diagonal
class LogisticRegression():
""" Logistic Regression classifier.
Parameters:
-----------
n_iters: int
Number of iterations running gradient descent, default is... | 37.035714 | 87 | 0.619094 | import numpy as np
import math
from ml_from_scratch.activation_functions import Sigmoid
from ml_from_scratch.utils import make_diagonal
class LogisticRegression():
def __init__(self, n_iters=1000, lr=.1, gradient_descent=True):
self.param = None
self.n_iters = n_iters
self.lr = lr
... | true | true |
790d0381cb1ede5d99111b85f3a651ded60b7712 | 6,969 | py | Python | DeepHyperion-BNG/self_driving/beamng_member.py | IharBakhanovich/DeepHyperion | f7f696ba95124125dfe967ea4890d944a9958d77 | [
"MIT"
] | null | null | null | DeepHyperion-BNG/self_driving/beamng_member.py | IharBakhanovich/DeepHyperion | f7f696ba95124125dfe967ea4890d944a9958d77 | [
"MIT"
] | null | null | null | DeepHyperion-BNG/self_driving/beamng_member.py | IharBakhanovich/DeepHyperion | f7f696ba95124125dfe967ea4890d944a9958d77 | [
"MIT"
] | null | null | null | import hashlib
import random
from typing import Tuple, Dict
from self_driving.beamng_config import BeamNGConfig
from self_driving.beamng_evaluator import BeamNGEvaluator
from core.member import Member
from self_driving.catmull_rom import catmull_rom
from self_driving.road_bbox import RoadBoundingBox
from self_driving.... | 37.67027 | 143 | 0.634094 | import hashlib
import random
from typing import Tuple, Dict
from self_driving.beamng_config import BeamNGConfig
from self_driving.beamng_evaluator import BeamNGEvaluator
from core.member import Member
from self_driving.catmull_rom import catmull_rom
from self_driving.road_bbox import RoadBoundingBox
from self_driving.... | true | true |
790d03d1b7da1dcc25982c68c84f0b3d13d04f5a | 494 | py | Python | moviemaker3/math/angle.py | friedrichromstedt/moviemaker3 | 7941a06d43bbbb63e45496044040a163ab97d78d | [
"MIT"
] | 1 | 2018-12-30T18:40:07.000Z | 2018-12-30T18:40:07.000Z | moviemaker3/math/angle.py | friedrichromstedt/moviemaker3 | 7941a06d43bbbb63e45496044040a163ab97d78d | [
"MIT"
] | null | null | null | moviemaker3/math/angle.py | friedrichromstedt/moviemaker3 | 7941a06d43bbbb63e45496044040a163ab97d78d | [
"MIT"
] | null | null | null | import numpy
from fframework import asfunction, OpFunction
__all__ = ['Angle']
class Angle(OpFunction):
"""Transforms a mesh into the angle of the mesh to the x axis."""
def __init__(self, mesh):
"""*mesh* is the mesh Function."""
self.mesh = asfunction(mesh)
def __call__(self, ps):
... | 24.7 | 70 | 0.621457 | import numpy
from fframework import asfunction, OpFunction
__all__ = ['Angle']
class Angle(OpFunction):
def __init__(self, mesh):
self.mesh = asfunction(mesh)
def __call__(self, ps):
meshT = self.mesh(ps).T
return numpy.arctan2(meshT[0], meshT[1]).T
| true | true |
790d0461ac16c3aab6091d7c9573443d7faa76fe | 2,047 | py | Python | python3/koans/about_dice_project.py | benrki/python_koans | 501bdf1c942bf543d36f8db3b9f9586205697b59 | [
"MIT"
] | null | null | null | python3/koans/about_dice_project.py | benrki/python_koans | 501bdf1c942bf543d36f8db3b9f9586205697b59 | [
"MIT"
] | null | null | null | python3/koans/about_dice_project.py | benrki/python_koans | 501bdf1c942bf543d36f8db3b9f9586205697b59 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import random
class DiceSet:
def __init__(self):
self._values = None
@property
def values(self):
return self._values
def roll(self, n):
# Needs implementing!
# Tip: random.randint(min, max) can ... | 28.041096 | 78 | 0.618955 |
from runner.koan import *
import random
class DiceSet:
def __init__(self):
self._values = None
@property
def values(self):
return self._values
def roll(self, n):
self._values = [random.randint(1, 6) for n in range(n)]
class AboutDiceProject(Koan):
... | true | true |
790d0606b205cdb3b56bbfcdcde511f028d7d6f3 | 16,952 | py | Python | gui_calculator.py | Eqwe-wewe/accounting-calculator | 02b9f830f116435e42dae84096fc5e326acf21db | [
"MIT"
] | 1 | 2022-02-22T14:12:58.000Z | 2022-02-22T14:12:58.000Z | gui_calculator.py | Eqwe-Wewe/accounting-calc | 02b9f830f116435e42dae84096fc5e326acf21db | [
"MIT"
] | null | null | null | gui_calculator.py | Eqwe-Wewe/accounting-calc | 02b9f830f116435e42dae84096fc5e326acf21db | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'calculator2.ui'
#
# Created by: PyQt5 UI code generator 5.15.3
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 impor... | 45.326203 | 80 | 0.616505 |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setEnabled(True)
MainWindow.setFixedSize(QtCore.QSize(471, 400))
MainWindow.setTabletTracking(False)
... | true | true |
790d074322597c94718db1631ea332656c11063e | 5,431 | py | Python | Python/env/Lib/site-packages/mysqlx/authentication.py | D12-ctrl/ProyectoFinal | 666047042308750d581328e32967f502a4476948 | [
"MIT"
] | 3 | 2021-01-07T18:27:35.000Z | 2021-01-13T19:15:01.000Z | Python/env/Lib/site-packages/mysqlx/authentication.py | D12-ctrl/ProyectoFinal | 666047042308750d581328e32967f502a4476948 | [
"MIT"
] | 20 | 2021-05-03T18:02:23.000Z | 2022-03-12T12:01:04.000Z | Lib/site-packages/mysqlx/authentication.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | 4 | 2021-07-13T19:44:06.000Z | 2021-08-13T07:49:35.000Z | # Copyright (c) 2016, 2020, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# ... | 31.034286 | 80 | 0.643528 |
import hashlib
import struct
from .helpers import hexlify
def xor_string(hash1, hash2, hash_size):
xored = [h1 ^ h2 for (h1, h2) in zip(hash1, hash2)]
return struct.pack("{0}B".format(hash_size), *xored)
class BaseAuthPlugin(object):
def __init__(self, username=None, passwo... | true | true |
790d08711e2336cba8b696ba7cafeb010a704e0b | 29,715 | py | Python | det3d/core/bbox/box_np_ops.py | motional/polarstream | 74af9548cad69a4f546b83dae7b87454bc590c9e | [
"MIT"
] | 9 | 2022-03-29T04:53:14.000Z | 2022-03-30T02:29:28.000Z | det3d/core/bbox/box_np_ops.py | motional/polarstream | 74af9548cad69a4f546b83dae7b87454bc590c9e | [
"MIT"
] | null | null | null | det3d/core/bbox/box_np_ops.py | motional/polarstream | 74af9548cad69a4f546b83dae7b87454bc590c9e | [
"MIT"
] | 1 | 2022-03-29T04:31:53.000Z | 2022-03-29T04:31:53.000Z | from pathlib import Path
import numba
import numpy as np
from det3d.core.bbox.geometry import (
points_count_convex_polygon_3d_jit,
points_in_convex_polygon_3d_jit,
)
try:
from spconv.utils import rbbox_intersection, rbbox_iou
except:
print("Import spconv fail, no support for sparse convolut... | 36.460123 | 88 | 0.57126 | from pathlib import Path
import numba
import numpy as np
from det3d.core.bbox.geometry import (
points_count_convex_polygon_3d_jit,
points_in_convex_polygon_3d_jit,
)
try:
from spconv.utils import rbbox_intersection, rbbox_iou
except:
print("Import spconv fail, no support for sparse convolut... | true | true |
790d08818998c5080469cdf9b93c4f5672c1cd17 | 2,531 | py | Python | ivy_builder/specs/network_spec.py | ivy-dl/builder | a24d7254e90476332b962f9aba9a02222c55e035 | [
"Apache-2.0"
] | 1 | 2022-02-20T15:40:01.000Z | 2022-02-20T15:40:01.000Z | ivy_builder/specs/network_spec.py | ivy-dl/builder | a24d7254e90476332b962f9aba9a02222c55e035 | [
"Apache-2.0"
] | null | null | null | ivy_builder/specs/network_spec.py | ivy-dl/builder | a24d7254e90476332b962f9aba9a02222c55e035 | [
"Apache-2.0"
] | 1 | 2022-03-29T15:21:56.000Z | 2022-03-29T15:21:56.000Z | # global
import ivy
import abc
import importlib
from typing import List
# local
from ivy_builder.specs.spec import Spec
from ivy_builder.specs import DatasetSpec
from ivy_builder.specs.spec import locals_to_kwargs
# ToDo: fix cyclic imports, so this method can be imported from the builder module
def load_class_from_... | 45.196429 | 114 | 0.594232 |
import ivy
import abc
import importlib
from typing import List
from ivy_builder.specs.spec import Spec
from ivy_builder.specs import DatasetSpec
from ivy_builder.specs.spec import locals_to_kwargs
def load_class_from_str(full_str):
mod_str = '.'.join(full_str.split('.')[:-1])
class_str = full_str.split('.... | true | true |
790d09b5e9809a10e91a44b3c53d8a7d68078a8c | 64 | py | Python | warsa/precipitation/satellite/__init__.py | JRoehrig/pywarsa | d2fcc6cebbadaff742bf2ac870a01b0cb534ebde | [
"MIT"
] | null | null | null | warsa/precipitation/satellite/__init__.py | JRoehrig/pywarsa | d2fcc6cebbadaff742bf2ac870a01b0cb534ebde | [
"MIT"
] | null | null | null | warsa/precipitation/satellite/__init__.py | JRoehrig/pywarsa | d2fcc6cebbadaff742bf2ac870a01b0cb534ebde | [
"MIT"
] | 1 | 2020-12-17T15:49:13.000Z | 2020-12-17T15:49:13.000Z | __author__ = 'roehrig'
"""Satellite and reanalysis products
"""
| 16 | 36 | 0.734375 | __author__ = 'roehrig'
| true | true |
790d0a13937996fb917e410c64335f4df346e4f2 | 3,893 | py | Python | lib/python2.7/site-packages/ldap3/protocol/formatters/validators.py | crav7/ProjectDjango | 10dc03919b1fcfc34d2ddc93b85989638399e3e9 | [
"MIT"
] | null | null | null | lib/python2.7/site-packages/ldap3/protocol/formatters/validators.py | crav7/ProjectDjango | 10dc03919b1fcfc34d2ddc93b85989638399e3e9 | [
"MIT"
] | null | null | null | lib/python2.7/site-packages/ldap3/protocol/formatters/validators.py | crav7/ProjectDjango | 10dc03919b1fcfc34d2ddc93b85989638399e3e9 | [
"MIT"
] | null | null | null | """
"""
# Created on 2016.08.09
#
# Author: Giovanni Cannata
#
# Copyright 2016, 2017 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundat... | 32.714286 | 103 | 0.645261 |
from datetime import datetime
from ... import SEQUENCE_TYPES, STRING_TYPES
from .formatters import format_time
def check_type(input_value, value_type):
if isinstance(input_value, value_type):
return True
if isinstance(input_value, SEQUENCE_TYPES):
for ... | true | true |
790d0a33bb7179331ba3ddcbb1b97ece1075af92 | 1,085 | py | Python | venv/Lib/site-packages/pathspec/__init__.py | gilbertekalea/booking.com_crawler | 71e52c87cd72a77f80a3e5fc0af0e1a68a5712ae | [
"MIT"
] | 92 | 2020-01-22T22:15:29.000Z | 2022-03-31T05:19:16.000Z | venv/Lib/site-packages/pathspec/__init__.py | gilbertekalea/booking.com_crawler | 71e52c87cd72a77f80a3e5fc0af0e1a68a5712ae | [
"MIT"
] | 604 | 2020-01-25T17:13:27.000Z | 2022-03-31T18:58:24.000Z | venv/Lib/site-packages/pathspec/__init__.py | gilbertekalea/booking.com_crawler | 71e52c87cd72a77f80a3e5fc0af0e1a68a5712ae | [
"MIT"
] | 39 | 2020-02-06T00:38:06.000Z | 2022-03-15T06:14:19.000Z | # encoding: utf-8
"""
The *pathspec* package provides pattern matching for file paths. So far
this only includes Git's wildmatch pattern matching (the style used for
".gitignore" files).
The following classes are imported and made available from the root of
the `pathspec` package:
- :class:`pathspec.pathspec.PathSpec... | 24.659091 | 72 | 0.784332 |
from __future__ import unicode_literals
from .pathspec import PathSpec
from .pattern import Pattern, RegexPattern
from .util import iter_tree, lookup_pattern, match_files, RecursionError
from ._meta import (
__author__,
__copyright__,
__credits__,
__license__,
__version__,
)
from . import patterns
from .pa... | true | true |
790d0a3cf8b88770e34396b24cfb8f7e4ed87451 | 15,369 | py | Python | renderer_blender_src.py | laphisboy/mvsnerf | ea1aecd7d653b04a7f4bec27ad978f64a038bc92 | [
"MIT"
] | null | null | null | renderer_blender_src.py | laphisboy/mvsnerf | ea1aecd7d653b04a7f4bec27ad978f64a038bc92 | [
"MIT"
] | null | null | null | renderer_blender_src.py | laphisboy/mvsnerf | ea1aecd7d653b04a7f4bec27ad978f64a038bc92 | [
"MIT"
] | null | null | null | import argparse
import re
####
# # Box 1
####
import sys,os,imageio,lpips
root = '/home/youngsun/documents/mvs/mvsnerf_timing'
os.chdir(root)
sys.path.append(root)
from opt_src import config_parser
from data import dataset_dict
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
# models
from ... | 39.919481 | 176 | 0.569133 | import argparse
import re
mageio,lpips
root = '/home/youngsun/documents/mvs/mvsnerf_timing'
os.chdir(root)
sys.path.append(root)
from opt_src import config_parser
from data import dataset_dict
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
from models_src import *
from renderer_src import ... | true | true |
790d0b17097b75a8c99d44990441c182fa50116e | 256 | py | Python | snippets_java/manage.py | edilio/snippets-javaos | e73d96876b98e021a4d6dd71582dad573a808931 | [
"MIT"
] | null | null | null | snippets_java/manage.py | edilio/snippets-javaos | e73d96876b98e021a4d6dd71582dad573a808931 | [
"MIT"
] | null | null | null | snippets_java/manage.py | edilio/snippets-javaos | e73d96876b98e021a4d6dd71582dad573a808931 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "snippets_java.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 23.272727 | 77 | 0.777344 |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "snippets_java.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| true | true |
790d0b4fb39541666568936c77711a563c883a0b | 2,182 | py | Python | data/p2DJ/New/program/cirq/startCirq347.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p2DJ/New/program/cirq/startCirq347.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p2DJ/New/program/cirq/startCirq347.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=2
# total number=20
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... | 31.171429 | 77 | 0.691567 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
from cirq.contrib.svg import SVGCircuit
def make_circuit(n: int, input_qubit):
c = cirq.Circuit()
c.append(cirq.H.on(input_qubit[0]))
c.append(cirq.CNOT.on(input_qubit[1],inp... | true | true |
790d0bc8937f8d7233fdd3bde8c43090775d1bfb | 250 | py | Python | CodeChef/FCTRL2.py | tapaswenipathak/Competitive-Programming | 97bba0f2ccdf587df93244a027050489f0905480 | [
"MIT"
] | 2 | 2019-04-20T18:03:20.000Z | 2019-08-17T21:20:47.000Z | CodeChef/FCTRL2.py | tapaswenipathak/Competitive-Programming | 97bba0f2ccdf587df93244a027050489f0905480 | [
"MIT"
] | null | null | null | CodeChef/FCTRL2.py | tapaswenipathak/Competitive-Programming | 97bba0f2ccdf587df93244a027050489f0905480 | [
"MIT"
] | 1 | 2019-04-20T18:03:26.000Z | 2019-04-20T18:03:26.000Z | import math
t = int(raw_input())
for i in range(t) :
n = int(raw_input())
print math.factorial(n)
'''Why using math.factorial() is faster?
beacuse many of the Python libraries are in C or C++ and not it Python.
Hence the speed improves.'''
| 22.727273 | 74 | 0.684 | import math
t = int(raw_input())
for i in range(t) :
n = int(raw_input())
print math.factorial(n)
'''Why using math.factorial() is faster?
beacuse many of the Python libraries are in C or C++ and not it Python.
Hence the speed improves.'''
| false | true |
790d0d154f090fac69313b75ff317cbf5ef6da28 | 450 | py | Python | calculator/calculator.py | ShaharGotshtat/parse-and-calculate-with-rabbitmq | 1cc781bd49f8b29596f773f18d640d4500ff9f70 | [
"MIT"
] | null | null | null | calculator/calculator.py | ShaharGotshtat/parse-and-calculate-with-rabbitmq | 1cc781bd49f8b29596f773f18d640d4500ff9f70 | [
"MIT"
] | null | null | null | calculator/calculator.py | ShaharGotshtat/parse-and-calculate-with-rabbitmq | 1cc781bd49f8b29596f773f18d640d4500ff9f70 | [
"MIT"
] | null | null | null | from rabbitmq_utils import read_messages
def solve_arithmetic_phrase(channel, method, properties, body):
with open('output.txt', 'a') as file:
try:
body_str = eval(body)
result = eval(body_str)
file.write(f'{body_str} = {result}\n')
return result
exc... | 28.125 | 68 | 0.624444 | from rabbitmq_utils import read_messages
def solve_arithmetic_phrase(channel, method, properties, body):
with open('output.txt', 'a') as file:
try:
body_str = eval(body)
result = eval(body_str)
file.write(f'{body_str} = {result}\n')
return result
exc... | true | true |
790d0d44bbc0cf87007a21d70ee7872e067e2e4e | 397 | py | Python | apiproject/apiproject/asgi.py | vasulimited123/Django-Repository | 0283dfd6396c58b52000c99667768145a8be3fd2 | [
"MIT"
] | null | null | null | apiproject/apiproject/asgi.py | vasulimited123/Django-Repository | 0283dfd6396c58b52000c99667768145a8be3fd2 | [
"MIT"
] | null | null | null | apiproject/apiproject/asgi.py | vasulimited123/Django-Repository | 0283dfd6396c58b52000c99667768145a8be3fd2 | [
"MIT"
] | null | null | null | """
ASGI config for apiproject project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apiproject.settings')
application = get_asgi_application()
| true | true |
790d0e3dc24ddaaa1a32a18ffd9f52882d01a2d3 | 1,176 | py | Python | inlineplz/env/jenkins.py | CtrlZvi/inline-plz | 208195372a8138dce78a165dd8410a8ce15aea80 | [
"0BSD"
] | 30 | 2016-01-11T18:43:38.000Z | 2022-01-29T19:09:53.000Z | inlineplz/env/jenkins.py | CtrlZvi/inline-plz | 208195372a8138dce78a165dd8410a8ce15aea80 | [
"0BSD"
] | 237 | 2016-01-09T23:01:19.000Z | 2022-03-01T16:12:10.000Z | inlineplz/env/jenkins.py | CtrlZvi/inline-plz | 208195372a8138dce78a165dd8410a8ce15aea80 | [
"0BSD"
] | 14 | 2016-01-19T00:51:52.000Z | 2022-01-12T20:49:31.000Z | # -*- coding: utf-8 -*-
import os
from ..env.base import EnvBase
try:
import urllib.parse as urlparse
except ImportError:
# pylint: disable=F0401
import urlparse
# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
class Jen... | 33.6 | 129 | 0.604592 |
import os
from ..env.base import EnvBase
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
if os.environ.get("ghprbPullId") or os.environ.get("ghprbActualCommit"):
self.pull_request = os.environ.get("ghprbPullId")
self.owner = (
os.env... | true | true |
790d0ea507fdc802318228f91936dfd5c9ccd77e | 1,215 | py | Python | backend/backend/views.py | mkorman9/python-build-system | 6bbbdd6adc656a4e5b5e0bb375881fedc7a8303c | [
"MIT"
] | null | null | null | backend/backend/views.py | mkorman9/python-build-system | 6bbbdd6adc656a4e5b5e0bb375881fedc7a8303c | [
"MIT"
] | 8 | 2018-02-11T20:59:52.000Z | 2018-02-12T12:39:46.000Z | backend/backend/views.py | mkorman9/django-url-shortener | 6bbbdd6adc656a4e5b5e0bb375881fedc7a8303c | [
"MIT"
] | null | null | null | from django.http import JsonResponse, HttpResponseRedirect
from rest_framework.decorators import api_view
from sdk.key_generation import generate_random_key
from sdk.storage import create_storage
from sdk.url import URL, ModelValidationError
storage = create_storage()
@api_view(['GET'])
def go_to(request, key, form... | 23.823529 | 58 | 0.64856 | from django.http import JsonResponse, HttpResponseRedirect
from rest_framework.decorators import api_view
from sdk.key_generation import generate_random_key
from sdk.storage import create_storage
from sdk.url import URL, ModelValidationError
storage = create_storage()
@api_view(['GET'])
def go_to(request, key, form... | true | true |
790d0ed5e2a12bd3bbe7d14fda9458dd742f8023 | 27,751 | gyp | Python | electron.gyp | frantic/electron | 4ebe71655b1575f985ddde5760f8f5cde8f03f0d | [
"MIT"
] | null | null | null | electron.gyp | frantic/electron | 4ebe71655b1575f985ddde5760f8f5cde8f03f0d | [
"MIT"
] | null | null | null | electron.gyp | frantic/electron | 4ebe71655b1575f985ddde5760f8f5cde8f03f0d | [
"MIT"
] | 1 | 2018-10-05T17:29:23.000Z | 2018-10-05T17:29:23.000Z | {
'variables': {
'project_name%': 'electron',
'product_name%': 'Electron',
'company_name%': 'GitHub, Inc',
'company_abbr%': 'github',
'version%': '0.0.0-dev',
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
},
'includes': [
'features.gypi',
'filenames.gypi',
'native_mate/n... | 33.966952 | 124 | 0.474145 | {
'variables': {
'project_name%': 'electron',
'product_name%': 'Electron',
'company_name%': 'GitHub, Inc',
'company_abbr%': 'github',
'version%': '0.0.0-dev',
'js2c_input_dir': '<(SHARED_INTERMEDIATE_DIR)/js2c',
},
'includes': [
'features.gypi',
'filenames.gypi',
'native_mate/n... | true | true |
790d0f0d3713353db16a2853b94844f519067aee | 3,458 | py | Python | examples/mnist_elastic_docker/mnist_slp_estimator.py | Pandinosaurus/KungFu | 80dfa463450330e920b413f65cc49d8e013b84a9 | [
"Apache-2.0"
] | 291 | 2019-10-25T16:37:59.000Z | 2022-03-17T21:47:09.000Z | examples/mnist_elastic_docker/mnist_slp_estimator.py | Pandinosaurus/KungFu | 80dfa463450330e920b413f65cc49d8e013b84a9 | [
"Apache-2.0"
] | 56 | 2019-10-26T08:25:33.000Z | 2021-09-07T11:11:51.000Z | examples/mnist_elastic_docker/mnist_slp_estimator.py | Pandinosaurus/KungFu | 80dfa463450330e920b413f65cc49d8e013b84a9 | [
"Apache-2.0"
] | 53 | 2019-10-25T17:45:40.000Z | 2022-02-08T13:09:39.000Z | import argparse
import functools
import operator
import os
import numpy as np
import tensorflow as tf
from kungfu.tensorflow.v1.helpers.mnist import load_datasets
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
def parse_args():
p = argparse.ArgumentParser(descript... | 34.58 | 79 | 0.589358 | import argparse
import functools
import operator
import os
import numpy as np
import tensorflow as tf
from kungfu.tensorflow.v1.helpers.mnist import load_datasets
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
def parse_args():
p = argparse.ArgumentParser(descript... | true | true |
790d0f4cae6c04cee14371883992c6d6d7803164 | 131,099 | py | Python | heat/tests/test_stack.py | stackriot/heat | 9ed612906e388eda8bf850420cbceef54e05841c | [
"Apache-2.0"
] | 265 | 2015-01-02T09:33:22.000Z | 2022-03-26T23:19:54.000Z | heat/tests/test_stack.py | stackriot/heat | 9ed612906e388eda8bf850420cbceef54e05841c | [
"Apache-2.0"
] | 8 | 2015-09-01T15:43:19.000Z | 2021-12-14T05:18:23.000Z | heat/tests/test_stack.py | stackriot/heat | 9ed612906e388eda8bf850420cbceef54e05841c | [
"Apache-2.0"
] | 295 | 2015-01-06T07:00:40.000Z | 2021-09-06T08:05:06.000Z | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | 41.965109 | 79 | 0.577625 |
import collections
import copy
import datetime
import json
import logging
import time
from unittest import mock
import eventlet
import fixtures
from oslo_config import cfg
from heat.common import context
from heat.common import exception
from heat.common import template_format
from heat.common import tim... | true | true |
790d10830720ef4112e2fe611db409a0fdb26ef7 | 6,272 | py | Python | pysrc/papers/analysis/topics.py | JetBrains-Research/pubtrends | 5352bec2cca3321f8554d8e60728fe6d8494edcb | [
"Apache-2.0"
] | 7 | 2022-01-10T15:48:31.000Z | 2022-02-28T11:42:15.000Z | pysrc/papers/analysis/topics.py | JetBrains-Research/pubtrends | 5352bec2cca3321f8554d8e60728fe6d8494edcb | [
"Apache-2.0"
] | 12 | 2021-11-04T17:21:10.000Z | 2022-02-23T15:01:10.000Z | pysrc/papers/analysis/topics.py | JetBrains-Research/pubtrends | 5352bec2cca3321f8554d8e60728fe6d8494edcb | [
"Apache-2.0"
] | null | null | null | import logging
from collections import Counter
from itertools import chain
import numpy as np
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import pairwise_distances
from pysrc.papers.analysis.text import get_frequent_tokens
logger = logging.getLogger(__name__)
def compute_topics_similar... | 46.117647 | 118 | 0.67331 | import logging
from collections import Counter
from itertools import chain
import numpy as np
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import pairwise_distances
from pysrc.papers.analysis.text import get_frequent_tokens
logger = logging.getLogger(__name__)
def compute_topics_similar... | true | true |
790d108a0cc7c6f00486c7e67db972bd9001b06e | 2,637 | py | Python | Programs/day_11_blackjack.py | Yunram/python_training | be3fbab05511716757ecdacef827a16329a85e90 | [
"Apache-2.0"
] | null | null | null | Programs/day_11_blackjack.py | Yunram/python_training | be3fbab05511716757ecdacef827a16329a85e90 | [
"Apache-2.0"
] | null | null | null | Programs/day_11_blackjack.py | Yunram/python_training | be3fbab05511716757ecdacef827a16329a85e90 | [
"Apache-2.0"
] | null | null | null | from art import logo_blackjack
from replit import clear
import random
def deal_card():
"""Return random card"""
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
card = random.choice(cards)
return card
def calculate_score(cards):
"""Take a list of cards and return the score"""
if sum(cards)... | 36.123288 | 102 | 0.665908 | from art import logo_blackjack
from replit import clear
import random
def deal_card():
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
card = random.choice(cards)
return card
def calculate_score(cards):
if sum(cards) == 21 and len(cards) == 2:
return 0
if 11 in cards and sum(cards) > ... | true | true |
790d12206b3ebd7f14bfba18d0ff708645d4e054 | 1,478 | py | Python | Python/pythonLevel1/python0811_file.py | PomTTcat/pythonPersonTips | adae81832211791342bcd3638d1aaa24796afea0 | [
"MIT"
] | null | null | null | Python/pythonLevel1/python0811_file.py | PomTTcat/pythonPersonTips | adae81832211791342bcd3638d1aaa24796afea0 | [
"MIT"
] | null | null | null | Python/pythonLevel1/python0811_file.py | PomTTcat/pythonPersonTips | adae81832211791342bcd3638d1aaa24796afea0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
print '-------操作文件和目录-------'
# 操作系统名字
print os.name + '\n'
print '\n' + '详细的系统信息'
print os.uname()
print '\n' + '环境变量'
print os.environ
print '\n' + '获取某个环境变量的值'
print os.getenv('PATH')
print '\n'
# 查看当前目录的绝对路径:
print os.path.abspath('.')
selfAbsPath = os.path.abspath('.')
#... | 18.948718 | 68 | 0.627876 |
import os
print '-------操作文件和目录-------'
print os.name + '\n'
print '\n' + '详细的系统信息'
print os.uname()
print '\n' + '环境变量'
print os.environ
print '\n' + '获取某个环境变量的值'
print os.getenv('PATH')
print '\n'
print os.path.abspath('.')
selfAbsPath = os.path.abspath('.')
filePathDir = os.path.join(selfAbsPath, 'tes... | false | true |
790d12c7411153b288ed8c80e7ca8a275e6ea043 | 352 | py | Python | db/backends/postgresql/base.py | felliott/SHARE | 8fd60ff4749349c9b867f6188650d71f4f0a1a56 | [
"Apache-2.0"
] | 1 | 2019-10-12T20:51:06.000Z | 2019-10-12T20:51:06.000Z | db/backends/postgresql/base.py | felliott/SHARE | 8fd60ff4749349c9b867f6188650d71f4f0a1a56 | [
"Apache-2.0"
] | 21 | 2020-06-01T13:59:32.000Z | 2021-08-01T06:20:29.000Z | db/backends/postgresql/base.py | aaxelb/SHARE | 896e4f0c0e119436c0aaea364ea19389e7099d59 | [
"Apache-2.0"
] | null | null | null | from django.db.backends.postgresql.base import DatabaseWrapper as PostgresqlDatabaseWrapper
from db.backends.postgresql.creation import DatabaseCreation
from db.backends.postgresql.schema import DatabaseSchemaEditor
class DatabaseWrapper(PostgresqlDatabaseWrapper):
creation_class = DatabaseCreation
SchemaEdi... | 35.2 | 91 | 0.863636 | from django.db.backends.postgresql.base import DatabaseWrapper as PostgresqlDatabaseWrapper
from db.backends.postgresql.creation import DatabaseCreation
from db.backends.postgresql.schema import DatabaseSchemaEditor
class DatabaseWrapper(PostgresqlDatabaseWrapper):
creation_class = DatabaseCreation
SchemaEdi... | true | true |
790d1336d03e7a6c5fd71d2681a02a2c8f297cef | 15,919 | py | Python | src/m3_more_nested_loops_in_sequences.py | dalesil/19-MoreLoopsWithinLoops | 008f0a24f1420135632472641ac4eb3718046e0b | [
"MIT"
] | null | null | null | src/m3_more_nested_loops_in_sequences.py | dalesil/19-MoreLoopsWithinLoops | 008f0a24f1420135632472641ac4eb3718046e0b | [
"MIT"
] | null | null | null | src/m3_more_nested_loops_in_sequences.py | dalesil/19-MoreLoopsWithinLoops | 008f0a24f1420135632472641ac4eb3718046e0b | [
"MIT"
] | null | null | null | """
This project demonstrates NESTED LOOPS (i.e., loops within loops)
in the context of SEQUENCES OF SUB-SEQUENCES.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Lucas D'Alesio.
""" # DONE: 1. PUT YOUR NAME IN THE AB... | 36.935035 | 79 | 0.519002 |
def main():
run_test_first_is_elsewhere_too()
def run_test_largest_number():
print()
print('-------------------------------------')
print('Testing the LARGEST_NUMBER function:')
print('-------------------------------------')
expected = 13
answ... | true | true |
790d1502e864285b9fca52303a5657729be5e026 | 4,462 | py | Python | tools/data/textdet/funsd_converter.py | nuveo/mmocr | f134421c628b87b03bd36f564626225ee6af966b | [
"Apache-2.0"
] | 1 | 2022-03-02T14:34:53.000Z | 2022-03-02T14:34:53.000Z | tools/data/textdet/funsd_converter.py | nuveo/mmocr | f134421c628b87b03bd36f564626225ee6af966b | [
"Apache-2.0"
] | null | null | null | tools/data/textdet/funsd_converter.py | nuveo/mmocr | f134421c628b87b03bd36f564626225ee6af966b | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import math
import os
import os.path as osp
import mmcv
from mmocr.utils import convert_annotations
def collect_files(img_dir, gt_dir):
"""Collect all images and their corresponding groundtruth files.
Args:
img_dir (str): The image dir... | 28.240506 | 79 | 0.613178 |
import argparse
import math
import os
import os.path as osp
import mmcv
from mmocr.utils import convert_annotations
def collect_files(img_dir, gt_dir):
assert isinstance(img_dir, str)
assert img_dir
assert isinstance(gt_dir, str)
assert gt_dir
ann_list, imgs_list = [], []
for gt_file in os... | true | true |
790d1557204d00d143353268325cbc0450d35ffd | 388 | py | Python | nkdsu/apps/vote/migrations/0003_track_metadata_locked.py | theshillito/nkd.su | 9d1166454dd909c755206e27a35c51391a12c588 | [
"BSD-3-Clause"
] | 1 | 2015-09-16T19:27:14.000Z | 2015-09-16T19:27:14.000Z | nkdsu/apps/vote/migrations/0003_track_metadata_locked.py | theshillito/nkd.su | 9d1166454dd909c755206e27a35c51391a12c588 | [
"BSD-3-Clause"
] | 55 | 2015-02-28T21:47:57.000Z | 2020-06-11T14:48:54.000Z | nkdsu/apps/vote/migrations/0003_track_metadata_locked.py | theshillito/nkd.su | 9d1166454dd909c755206e27a35c51391a12c588 | [
"BSD-3-Clause"
] | 1 | 2017-12-16T20:56:49.000Z | 2017-12-16T20:56:49.000Z | # Generated by Django 2.2.12 on 2020-07-05 18:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vote', '0002_request_track'),
]
operations = [
migrations.AddField(
model_name='track',
name='metadata_locked',
... | 20.421053 | 53 | 0.600515 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vote', '0002_request_track'),
]
operations = [
migrations.AddField(
model_name='track',
name='metadata_locked',
field=models.BooleanField(default=False... | true | true |
790d155c083336d246ea68e1ea36ef42ffc98b10 | 3,731 | py | Python | test/IECore/Turbulence.py | gcodebackups/cortex-vfx | 72fa6c6eb3327fce4faf01361c8fcc2e1e892672 | [
"BSD-3-Clause"
] | 5 | 2016-07-26T06:09:28.000Z | 2022-03-07T03:58:51.000Z | test/IECore/Turbulence.py | turbosun/cortex | 4bdc01a692652cd562f3bfa85f3dae99d07c0b15 | [
"BSD-3-Clause"
] | null | null | null | test/IECore/Turbulence.py | turbosun/cortex | 4bdc01a692652cd562f3bfa85f3dae99d07c0b15 | [
"BSD-3-Clause"
] | 3 | 2015-03-25T18:45:24.000Z | 2020-02-15T15:37:18.000Z | ##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | 31.352941 | 88 | 0.670598 | true | true | |
790d15997c402709a16402938cdb7e7c649a1bff | 3,628 | py | Python | python/GafferUI/WidgetAlgo.py | mattigruener/gaffer | 8216ba1a884712575a0acae747c51b02f7a99a5d | [
"BSD-3-Clause"
] | null | null | null | python/GafferUI/WidgetAlgo.py | mattigruener/gaffer | 8216ba1a884712575a0acae747c51b02f7a99a5d | [
"BSD-3-Clause"
] | 2 | 2017-08-23T21:35:45.000Z | 2018-01-29T08:59:33.000Z | python/GafferUI/WidgetAlgo.py | mattigruener/gaffer | 8216ba1a884712575a0acae747c51b02f7a99a5d | [
"BSD-3-Clause"
] | null | null | null | ##########################################################################
#
# Copyright (c) 2017, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 37.402062 | 123 | 0.693219 | true | true | |
790d16644a299f1fcc3deed64fe02f419411ed00 | 621 | py | Python | jaseci_core/jaseci/attr/item.py | Gorgeous-Patrick/jaseci | b423165fefbbc9574cd4467ee05728add7f47e5a | [
"MIT"
] | 6 | 2021-10-30T03:35:36.000Z | 2022-02-10T02:06:18.000Z | jaseci_core/jaseci/attr/item.py | Gorgeous-Patrick/jaseci | b423165fefbbc9574cd4467ee05728add7f47e5a | [
"MIT"
] | 85 | 2021-10-29T22:47:39.000Z | 2022-03-31T06:11:52.000Z | jaseci_core/jaseci/attr/item.py | Gorgeous-Patrick/jaseci | b423165fefbbc9574cd4467ee05728add7f47e5a | [
"MIT"
] | 12 | 2021-11-03T17:29:22.000Z | 2022-03-30T16:01:53.000Z | """
Item class for Jaseci
Each item has an id, name, timestamp.
"""
from jaseci.element.element import element
class item(element):
"""Item class for Jaseci"""
def __init__(self, value=None, *args, **kwargs):
self.item_value = value
super().__init__(*args, **kwargs)
@property
def va... | 20.7 | 55 | 0.584541 | from jaseci.element.element import element
class item(element):
def __init__(self, value=None, *args, **kwargs):
self.item_value = value
super().__init__(*args, **kwargs)
@property
def value(self):
return self.item_value
@value.setter
def value(self, val):
self.i... | true | true |
790d16ec2e8cb18374ad78b563151c1228056379 | 233 | py | Python | modules/process.py | Steve132/loquis | 49c9efcdcd8e29ceec662e11cb89d7e00db7d1d7 | [
"MIT"
] | null | null | null | modules/process.py | Steve132/loquis | 49c9efcdcd8e29ceec662e11cb89d7e00db7d1d7 | [
"MIT"
] | null | null | null | modules/process.py | Steve132/loquis | 49c9efcdcd8e29ceec662e11cb89d7e00db7d1d7 | [
"MIT"
] | null | null | null | import loquis
import subprocess
@loquis.command
def run(query,*args):
try:
L=[query.lower()]+list(args)
print(L)
return [subprocess.check_output(L)]
except:
return ["Failed to run command"]
languages={'en':{'run':run}}
| 15.533333 | 37 | 0.686695 | import loquis
import subprocess
@loquis.command
def run(query,*args):
try:
L=[query.lower()]+list(args)
print(L)
return [subprocess.check_output(L)]
except:
return ["Failed to run command"]
languages={'en':{'run':run}}
| true | true |
790d16f5b63406cdab58504717a604eae8b2e149 | 4,919 | py | Python | seisflows/tools/graphics.py | fanwu8/sf | 8ce5671a3f8c2e8f3425aabc373fc58954f5bdbf | [
"BSD-2-Clause"
] | 1 | 2021-09-17T18:25:55.000Z | 2021-09-17T18:25:55.000Z | seisflows/tools/graphics.py | fanwu8/sf | 8ce5671a3f8c2e8f3425aabc373fc58954f5bdbf | [
"BSD-2-Clause"
] | null | null | null | seisflows/tools/graphics.py | fanwu8/sf | 8ce5671a3f8c2e8f3425aabc373fc58954f5bdbf | [
"BSD-2-Clause"
] | 1 | 2019-06-27T19:16:30.000Z | 2019-06-27T19:16:30.000Z |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from obspy.core.stream import Stream
def plot_gll(x, y, z):
""" Plots values on 2D unstructured GLL mesh
"""
r = (max(x) - min(x))/(max(y) - min(y))
rx = r/np.sqrt(1 + r**2)
ry = 1/np.sqrt(1 + r**2)
f ... | 23.878641 | 102 | 0.61049 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from obspy.core.stream import Stream
def plot_gll(x, y, z):
r = (max(x) - min(x))/(max(y) - min(y))
rx = r/np.sqrt(1 + r**2)
ry = 1/np.sqrt(1 + r**2)
f = plt.figure(figsize=(10*rx, 10*ry))
p = plt.triconto... | true | true |
790d171ff6fc66d68231509c1a8420a5f0905f52 | 327 | py | Python | CTD_controller/gps_test1.py | Raniita/Accuatic-Probe | fc0054b5c1a3a9be979379d8c7838cf1406c473f | [
"MIT"
] | 1 | 2021-11-13T14:55:21.000Z | 2021-11-13T14:55:21.000Z | CTD_controller/gps_test1.py | Raniita/Ocean-CTD | fc0054b5c1a3a9be979379d8c7838cf1406c473f | [
"MIT"
] | null | null | null | CTD_controller/gps_test1.py | Raniita/Ocean-CTD | fc0054b5c1a3a9be979379d8c7838cf1406c473f | [
"MIT"
] | null | null | null | import serial
import pynmea2
# Probando con el pincho usb azul
ser = serial.Serial('/dev/ttyUSB0',4800)
while 1:
try:
data = ser.readline().decode('utf-8')
if(data.startswith("$GPGGA")):
parse = pynmea2.parse(data)
print(repr(parse))
except UnicodeDecodeError:
c... | 23.357143 | 45 | 0.617737 | import serial
import pynmea2
ser = serial.Serial('/dev/ttyUSB0',4800)
while 1:
try:
data = ser.readline().decode('utf-8')
if(data.startswith("$GPGGA")):
parse = pynmea2.parse(data)
print(repr(parse))
except UnicodeDecodeError:
continue | true | true |
790d17afceb80fa17d6809240e3a4e5529a0f458 | 762 | py | Python | data/stackoverflow/dataset.py | xuwanwei/FedML | c049a30d9839c4554e7e14b0c18275e96fea8130 | [
"Apache-2.0"
] | 1,120 | 2020-07-22T02:30:52.000Z | 2022-03-31T08:10:44.000Z | data/stackoverflow/dataset.py | xuwanwei/FedML | c049a30d9839c4554e7e14b0c18275e96fea8130 | [
"Apache-2.0"
] | 113 | 2020-07-27T03:48:09.000Z | 2022-03-30T03:25:56.000Z | data/stackoverflow/dataset.py | xuwanwei/FedML | c049a30d9839c4554e7e14b0c18275e96fea8130 | [
"Apache-2.0"
] | 381 | 2020-07-22T06:12:57.000Z | 2022-03-30T18:38:35.000Z | import tensorflow_federated as tff
def download_and_save_stackoverflow():
tff.simulation.datasets.stackoverflow.load_data(cache_dir='./')
def download_and_save_word_counts():
tff.simulation.datasets.stackoverflow.load_word_counts(cache_dir='./')
def download_and_save_tag_counts():
tff.simulation.datas... | 29.307692 | 116 | 0.799213 | import tensorflow_federated as tff
def download_and_save_stackoverflow():
tff.simulation.datasets.stackoverflow.load_data(cache_dir='./')
def download_and_save_word_counts():
tff.simulation.datasets.stackoverflow.load_word_counts(cache_dir='./')
def download_and_save_tag_counts():
tff.simulation.datas... | true | true |
790d18c000cbd34272ce5e58feb3eb2b358ab314 | 223 | py | Python | models/layer/__init__.py | LegenDong/IQIYI_VID_FACE_2019 | 258ff9282206e7b7074ed9ada5ef928bc9305ec6 | [
"MIT"
] | 17 | 2019-07-11T02:41:01.000Z | 2022-01-13T05:13:24.000Z | models/layer/__init__.py | xmpy/IQIYI_VID_FACE_2019 | 258ff9282206e7b7074ed9ada5ef928bc9305ec6 | [
"MIT"
] | 1 | 2021-04-16T15:37:12.000Z | 2021-04-17T13:46:57.000Z | models/layer/__init__.py | LegenDong/IQIYI_VID_FACE_2019 | 258ff9282206e7b7074ed9ada5ef928bc9305ec6 | [
"MIT"
] | 5 | 2019-07-23T02:18:04.000Z | 2021-07-14T03:42:32.000Z | # -*- coding: utf-8 -*-
# @Time : 2019/5/11 15:12
# @Author : LegenDong
# @User : legendong
# @File : __init__.py.py
# @Software: PyCharm
from .channel_attention_layer import *
from .nan_attention_layer import *
| 22.3 | 38 | 0.654709 |
from .channel_attention_layer import *
from .nan_attention_layer import *
| true | true |
790d19613a477fabf2d42a3423b461b97ae79ed8 | 9,812 | py | Python | openpyxl/packaging/tests/test_manifest.py | chenc2/openpyxl | 0f9044a55ccf1b738f66195444a83a88a1cfb854 | [
"MIT"
] | null | null | null | openpyxl/packaging/tests/test_manifest.py | chenc2/openpyxl | 0f9044a55ccf1b738f66195444a83a88a1cfb854 | [
"MIT"
] | null | null | null | openpyxl/packaging/tests/test_manifest.py | chenc2/openpyxl | 0f9044a55ccf1b738f66195444a83a88a1cfb854 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyxl
import pytest
from io import BytesIO
from zipfile import ZipFile
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
from ..manifest import WORKSHEET_TYPE
@pytest.fixture
def FileExtension():
... | 34.188153 | 135 | 0.603139 | from __future__ import absolute_import
import pytest
from io import BytesIO
from zipfile import ZipFile
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
from ..manifest import WORKSHEET_TYPE
@pytest.fixture
def FileExtension():
from ..manifest import FileExt... | true | true |
790d19ac33725a0573f7bf558dfd94112c839fe9 | 1,655 | py | Python | araig_calculators/src/comparators/comp_param.py | ipa-kut/araig_test_stack | 9b8f0b4ed7fffc052e52de04a8e1b27db521d0b4 | [
"Apache-2.0"
] | null | null | null | araig_calculators/src/comparators/comp_param.py | ipa-kut/araig_test_stack | 9b8f0b4ed7fffc052e52de04a8e1b27db521d0b4 | [
"Apache-2.0"
] | null | null | null | araig_calculators/src/comparators/comp_param.py | ipa-kut/araig_test_stack | 9b8f0b4ed7fffc052e52de04a8e1b27db521d0b4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from multipledispatch import dispatch as Override
import rospy
import threading
from std_msgs.msg import Float64
from araig_msgs.msg import BoolStamped
from base_classes.base_calculator import BaseCalculator
"""Compare data from one topic with one param
pub_list = {"out_bool": "BoolStamped"}... | 29.553571 | 76 | 0.610876 |
from multipledispatch import dispatch as Override
import rospy
import threading
from std_msgs.msg import Float64
from araig_msgs.msg import BoolStamped
from base_classes.base_calculator import BaseCalculator
class compParam(BaseCalculator):
_pub_topic = "/out_bool"
_sub_topic = "/in_float"
def __init__(s... | true | true |
790d19c0597d4813beb5c2998926c1d171ef9736 | 4,625 | py | Python | georss_ign_sismologia_client/__init__.py | exxamalte/python-georss-ign-sismologia-client | 0927f474159b466b43c75d8b8df0c9dd9e6c1084 | [
"Apache-2.0"
] | null | null | null | georss_ign_sismologia_client/__init__.py | exxamalte/python-georss-ign-sismologia-client | 0927f474159b466b43c75d8b8df0c9dd9e6c1084 | [
"Apache-2.0"
] | 2 | 2021-06-12T15:12:22.000Z | 2021-07-03T09:34:24.000Z | georss_ign_sismologia_client/__init__.py | exxamalte/python-georss-ign-sismologia-client | 0927f474159b466b43c75d8b8df0c9dd9e6c1084 | [
"Apache-2.0"
] | 2 | 2019-09-24T09:20:06.000Z | 2021-07-02T15:54:21.000Z | """
IGN Instituto Geográfico Nacional Sismología Feed.
Fetches GeoRSS feed from IGN Instituto Geográfico Nacional Sismología.
"""
from datetime import datetime
from typing import Optional
import dateparser as dateparser
from georss_client import FeedEntry, GeoRssFeed
from georss_client.consts import CUSTOM_ATTRIBUTE
... | 33.035714 | 85 | 0.65773 | from datetime import datetime
from typing import Optional
import dateparser as dateparser
from georss_client import FeedEntry, GeoRssFeed
from georss_client.consts import CUSTOM_ATTRIBUTE
from georss_client.feed_manager import FeedManagerBase
ATTRIBUTION = "Instituto Geográfico Nacional"
IMAGE_URL_PATTERN = (
"h... | true | true |
790d1bbabbebaa639d68b3ec8915702c7dd56273 | 32,391 | py | Python | cumulusci/tasks/bulkdata.py | davidmreed/CumulusCI | 933159305e9fc0448087366b5f69484cc01a7a12 | [
"BSD-3-Clause"
] | null | null | null | cumulusci/tasks/bulkdata.py | davidmreed/CumulusCI | 933159305e9fc0448087366b5f69484cc01a7a12 | [
"BSD-3-Clause"
] | null | null | null | cumulusci/tasks/bulkdata.py | davidmreed/CumulusCI | 933159305e9fc0448087366b5f69484cc01a7a12 | [
"BSD-3-Clause"
] | null | null | null | from future import standard_library
standard_library.install_aliases()
from builtins import zip
from contextlib import contextmanager
import datetime
import io
import os
import time
import tempfile
import xml.etree.ElementTree as ET
from salesforce_bulk.util import IteratorBytesIO
from sqlalchemy.ext.automap import a... | 39.35723 | 150 | 0.59038 | from future import standard_library
standard_library.install_aliases()
from builtins import zip
from contextlib import contextmanager
import datetime
import io
import os
import time
import tempfile
import xml.etree.ElementTree as ET
from salesforce_bulk.util import IteratorBytesIO
from sqlalchemy.ext.automap import a... | true | true |
790d1c0e82f31a38771f3294625c990afbc23d97 | 5,141 | py | Python | paper_results/PLEDGE/tax/data_transformation_scripts/create_tax_csv.py | john-doe-3141592653/XXX | d8840663fa73cc78281e7bd3a6df980e7440a3cc | [
"CECILL-B"
] | null | null | null | paper_results/PLEDGE/tax/data_transformation_scripts/create_tax_csv.py | john-doe-3141592653/XXX | d8840663fa73cc78281e7bd3a6df980e7440a3cc | [
"CECILL-B"
] | null | null | null | paper_results/PLEDGE/tax/data_transformation_scripts/create_tax_csv.py | john-doe-3141592653/XXX | d8840663fa73cc78281e7bd3a6df980e7440a3cc | [
"CECILL-B"
] | null | null | null | import statistics as stat
import os
def array_to_string(array):
res = ""
for a in array:
res += str(a) + ";"
return res[:-1] + "\n"
for i in range(10):
for j in range(100):
none_id = ""
vision_id = ""
a_id = ""
fr_id = ""
lu_id = ""
de_id = ""
be_id = ""
other_id = ""
nb_tax_payer = -1
di... | 27.491979 | 89 | 0.536082 | import statistics as stat
import os
def array_to_string(array):
res = ""
for a in array:
res += str(a) + ";"
return res[:-1] + "\n"
for i in range(10):
for j in range(100):
none_id = ""
vision_id = ""
a_id = ""
fr_id = ""
lu_id = ""
de_id = ""
be_id = ""
other_id = ""
nb_tax_payer = -1
di... | false | true |
790d1c7d35bc3f38aa1958cb1f817e9d71b575aa | 43,253 | py | Python | pipenv/utils.py | bryant1410/pipenv | 5cdf493dbae431fc486b953c4279b04b0837c95b | [
"MIT"
] | null | null | null | pipenv/utils.py | bryant1410/pipenv | 5cdf493dbae431fc486b953c4279b04b0837c95b | [
"MIT"
] | null | null | null | pipenv/utils.py | bryant1410/pipenv | 5cdf493dbae431fc486b953c4279b04b0837c95b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import errno
import os
import re
import hashlib
import tempfile
import sys
import shutil
import logging
import click
import crayons
import delegator
import parse
import requests
import six
import stat
import warnings
try:
from weakref import finalize
except ImportError:
try:
fro... | 33.712393 | 116 | 0.586711 |
import errno
import os
import re
import hashlib
import tempfile
import sys
import shutil
import logging
import click
import crayons
import delegator
import parse
import requests
import six
import stat
import warnings
try:
from weakref import finalize
except ImportError:
try:
from .vendor.backports.wea... | true | true |
790d1d156c14fb67cadee7b13ae38aaf71bb5702 | 3,172 | py | Python | sgdr_callback.py | Callidior/semantic-embeddings | 0d4177422bafbba685fb6a0f976675864f31e09f | [
"MIT"
] | 238 | 2018-11-12T03:37:10.000Z | 2022-01-31T19:11:39.000Z | sgdr_callback.py | juancprzs/semantic-embeddings | 6d826c314b41e67f1cdc0158279d15b7b5063a5f | [
"MIT"
] | 6 | 2019-04-27T20:41:57.000Z | 2021-04-26T09:10:36.000Z | sgdr_callback.py | Callidior/semantic-embeddings | 0d4177422bafbba685fb6a0f976675864f31e09f | [
"MIT"
] | 48 | 2018-11-22T14:49:53.000Z | 2022-03-14T10:48:18.000Z | import numpy as np
from keras.callbacks import Callback
from keras import backend as K
class SGDR(Callback):
"""This callback implements the learning rate schedule for
Stochastic Gradient Descent with warm Restarts (SGDR),
as proposed by Loshchilov & Hutter (https://arxiv.org/abs/1608.03983).
The... | 36.045455 | 129 | 0.60372 | import numpy as np
from keras.callbacks import Callback
from keras import backend as K
class SGDR(Callback):
def __init__(self, min_lr=0.0, max_lr=0.05, base_epochs=10, mul_epochs=2):
super(SGDR, self).__init__()
self.min_lr = min_lr
self.max_lr = max_lr
self.base_epochs = base_e... | true | true |
790d1d1bb17c17868a163ec4edcc232711174652 | 1,877 | py | Python | tests/sentry/web/frontend/test_group_tag_export.py | noscripter/sentry | 1c5b1b53e740ffd2747afb7f0995e026be9468d0 | [
"BSD-3-Clause"
] | 1 | 2021-08-10T06:07:13.000Z | 2021-08-10T06:07:13.000Z | tests/sentry/web/frontend/test_group_tag_export.py | fotinakis/sentry | c5cfa5c5e47475bf5ef41e702548c2dfc7bb8a7c | [
"BSD-3-Clause"
] | 5 | 2019-12-28T18:13:59.000Z | 2022-03-02T04:32:45.000Z | tests/sentry/web/frontend/test_group_tag_export.py | fotinakis/sentry | c5cfa5c5e47475bf5ef41e702548c2dfc7bb8a7c | [
"BSD-3-Clause"
] | 1 | 2017-04-08T04:09:18.000Z | 2017-04-08T04:09:18.000Z | from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from sentry.models import GroupTagValue, TagKey, TagValue
from sentry.testutils import TestCase
class GroupTagExportTest(TestCase):
def test_simple(self):
key, value = 'foo', 'bar'
# Drop mic... | 32.362069 | 94 | 0.571124 | from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from sentry.models import GroupTagValue, TagKey, TagValue
from sentry.testutils import TestCase
class GroupTagExportTest(TestCase):
def test_simple(self):
key, value = 'foo', 'bar'
n... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.