hexsha stringlengths 40 40 | size int64 6 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | 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 247 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | 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 247 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 1 1.04M | avg_line_length float64 1.53 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 6 1.04M | filtered:remove_non_ascii int64 0 538k | filtered:remove_decorators int64 0 917k | filtered:remove_async int64 0 722k | filtered:remove_classes int64 -45 1M | filtered:remove_generators int64 0 814k | filtered:remove_function_no_docstring int64 -102 850k | filtered:remove_class_no_docstring int64 -3 5.46k | filtered:remove_unused_imports int64 -1,350 52.4k | filtered:remove_delete_markers int64 0 59.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c009204eb558f1738c123127ccfa1c1e5989bbef | 1,272 | py | Python | TP2/ej4/ej4a_mpi_producto_matricial.py | exegonzalez/Computacion-Avanzada | 04e9ba311e8be4fe1e2bbded933d5c8e3ae1a2e0 | [
"MIT"
] | null | null | null | TP2/ej4/ej4a_mpi_producto_matricial.py | exegonzalez/Computacion-Avanzada | 04e9ba311e8be4fe1e2bbded933d5c8e3ae1a2e0 | [
"MIT"
] | null | null | null | TP2/ej4/ej4a_mpi_producto_matricial.py | exegonzalez/Computacion-Avanzada | 04e9ba311e8be4fe1e2bbded933d5c8e3ae1a2e0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import numpy as np
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
root = 0
matrix = None # matriz n*n vaca
bufferReceptor = np.zeros((1, size), dtype=np.int) # vector columna vaco
vectorResultOfProduct = np.zeros((size, 1), dtype=np.int) # vector res... | 33.473684 | 99 | 0.735849 | #!/usr/bin/env python3
import numpy as np
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
root = 0
matrix = None # matriz n*n vacía
bufferReceptor = np.zeros((1, size), dtype=np.int) # vector columna vacío
vectorResultOfProduct = np.zeros((size, 1), dtype=np.int) # vector r... | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
b766fcc5811888e9309d21a699e075f85243b5f7 | 5,412 | py | Python | adaboost/AdaBoost.py | FelixOpolka/Statistical-Learning-Algorithms | 16152d54bc5610b1f0268d2335eb578e4f6d2982 | [
"MIT"
] | null | null | null | adaboost/AdaBoost.py | FelixOpolka/Statistical-Learning-Algorithms | 16152d54bc5610b1f0268d2335eb578e4f6d2982 | [
"MIT"
] | null | null | null | adaboost/AdaBoost.py | FelixOpolka/Statistical-Learning-Algorithms | 16152d54bc5610b1f0268d2335eb578e4f6d2982 | [
"MIT"
] | null | null | null | """Implementation of an ensemble of classification predictors trained
using the AdaBoost.M1 algorithm."""
def increment_counter(dictionary, key, value=1):
"""Increments the counter for a given key in the given dictionary or
sets the counter to 1 if it does not yet exist."""
if key in dictionary:
d... | 43.645161 | 78 | 0.650961 | """Implementation of an ensemble of classification predictors trained
using the AdaBoost.M1 algorithm."""
import math
import operator
import random
def increment_counter(dictionary, key, value=1):
"""Increments the counter for a given key in the given dictionary or
sets the counter to 1 if it does not yet ex... | 0 | 257 | 0 | 4,702 | 0 | 0 | 0 | -24 | 90 |
06f22e1d94fc4f893226c6063dc30fb8c3589f8c | 14,068 | py | Python | tests/swim_aim/xml/test_mapper_fields.py | eurocontrol-swim/swim-aim | d1dd3ce9d4abd84a5d16a877a86b6daaed5e6b49 | [
"BSD-3-Clause"
] | null | null | null | tests/swim_aim/xml/test_mapper_fields.py | eurocontrol-swim/swim-aim | d1dd3ce9d4abd84a5d16a877a86b6daaed5e6b49 | [
"BSD-3-Clause"
] | null | null | null | tests/swim_aim/xml/test_mapper_fields.py | eurocontrol-swim/swim-aim | d1dd3ce9d4abd84a5d16a877a86b6daaed5e6b49 | [
"BSD-3-Clause"
] | null | null | null | """
Copyright 2019 EUROCONTROL
==========================================
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions an... | 51.156364 | 206 | 0.644655 | """
Copyright 2019 EUROCONTROL
==========================================
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions an... | 0 | 11,777 | 0 | 0 | 0 | 0 | 0 | 125 | 341 |
15482e96560786fd582cf31cf0ff351e114cf26e | 7,758 | py | Python | train.py | rnbwdsh/VisRNN_ICLR_2016_Text | d87290cd4a71dda5ab68574b68fedbec9b6314ff | [
"MIT"
] | null | null | null | train.py | rnbwdsh/VisRNN_ICLR_2016_Text | d87290cd4a71dda5ab68574b68fedbec9b6314ff | [
"MIT"
] | null | null | null | train.py | rnbwdsh/VisRNN_ICLR_2016_Text | d87290cd4a71dda5ab68574b68fedbec9b6314ff | [
"MIT"
] | null | null | null | import torch.optim as optim
import numpy as np
'''
'''
def train(train_data, val_data, vocab, config, clip=5):
''' Training a network
Arguments
---------
:param clip:
:param config:
:param vocab:
:param val_data:
:param train_data:
'''
train_on_gp... | 39.181818 | 148 | 0.579144 | import torch.optim as optim
from tqdm import tqdm
import numpy as np
from model import *
from utils import *
from config import *
'''
'''
def train(train_data, val_data, vocab, config, clip=5):
''' Training a network
Arguments
---------
:param clip:
:param config:
:para... | 0 | 0 | 0 | 0 | 0 | 2,473 | 0 | -5 | 113 |
0a4709b2df197fcd2cc084b945d4d67fbbb7ca49 | 2,208 | py | Python | simplipy/device/sensor/v3.py | epenet/simplisafe-python | 1ac074788e3560ca2ba568e12b411537c23275d4 | [
"MIT"
] | 3 | 2017-05-21T16:49:38.000Z | 2018-07-05T16:16:45.000Z | simplipy/device/sensor/v3.py | epenet/simplisafe-python | 1ac074788e3560ca2ba568e12b411537c23275d4 | [
"MIT"
] | 2 | 2017-07-20T11:57:23.000Z | 2018-09-24T03:03:19.000Z | simplipy/device/sensor/v3.py | epenet/simplisafe-python | 1ac074788e3560ca2ba568e12b411537c23275d4 | [
"MIT"
] | 7 | 2017-04-15T05:52:09.000Z | 2018-08-19T01:49:54.000Z | """Define a v3 (new) SimpliSafe sensor."""
from __future__ import annotations
| 27.6 | 87 | 0.567482 | """Define a v3 (new) SimpliSafe sensor."""
from __future__ import annotations
from typing import Any, cast
from simplipy.device import DeviceTypes, DeviceV3
class SensorV3(DeviceV3):
"""A V3 (new) sensor.
Note that this class shouldn't be instantiated directly; it will be
instantiated as appropriate vi... | 0 | 1,363 | 0 | 662 | 0 | 0 | 0 | 35 | 69 |
328315cc5bccbe9bfd886047c5d1f90c2580ac69 | 2,829 | py | Python | cliTools/avdcli_redis_tools/venv/lib/python3.6/site-packages/avdcli/AVDApp.py | emile-bernard/Dockerized_ELK_Stack | 74f7956b6fb5a4dbee25953b2a23c61383ea6fc8 | [
"MIT"
] | 1 | 2020-07-22T19:50:08.000Z | 2020-07-22T19:50:08.000Z | cliTools/avdcli_redis_tools/venv/lib/python3.6/site-packages/avdcli/AVDApp.py | emile-bernard/Dockerized_ELK_Stack | 74f7956b6fb5a4dbee25953b2a23c61383ea6fc8 | [
"MIT"
] | null | null | null | cliTools/avdcli_redis_tools/venv/lib/python3.6/site-packages/avdcli/AVDApp.py | emile-bernard/Dockerized_ELK_Stack | 74f7956b6fb5a4dbee25953b2a23c61383ea6fc8 | [
"MIT"
] | null | null | null |
if __name__ == "__main__":
AVDApp.run()
| 36.269231 | 132 | 0.621421 | import json
import os
from getpass import getpass as gp
from plumbum import cli, colors
from avdlogger import lpl
class AVDApp(cli.Application):
COLOR_MANDATORY = colors.bold & colors.yellow
def __init__(self, *args):
super().__init__(*args)
self.username = ""
self.password = ""
... | 4 | 1,453 | 0 | 1,188 | 0 | 0 | 0 | 4 | 135 |
6916513601290d8742f31275479aebc5931c7597 | 18,476 | py | Python | tests.py | 0scarB/tail-recursive | 458f4559bb7b0afe738e54fa79941e49775d9525 | [
"MIT"
] | 3 | 2020-09-03T03:25:50.000Z | 2021-06-15T14:40:07.000Z | tests.py | 0scarB/tail-recursive | 458f4559bb7b0afe738e54fa79941e49775d9525 | [
"MIT"
] | 2 | 2021-12-31T11:16:20.000Z | 2022-01-10T01:49:23.000Z | tests.py | 0scarB/tail-recursive | 458f4559bb7b0afe738e54fa79941e49775d9525 | [
"MIT"
] | null | null | null |
from tail_recursive import FeatureSet
ALL_FEATURE_SETS = [
FeatureSet.BASE,
FeatureSet.NESTED_CALLS,
FeatureSet.FULL
]
| 32.132174 | 143 | 0.653388 | from contextlib import contextmanager
import concurrent.futures
import sys
import time
import pytest
from tail_recursive import tail_recursive, FeatureSet
ALL_FEATURE_SETS = [
FeatureSet.BASE,
FeatureSet.NESTED_CALLS,
FeatureSet.FULL
]
def non_recursive_factorial(n):
result = 1
for coefficient... | 0 | 8,840 | 0 | 112 | 0 | 8,625 | 0 | 7 | 732 |
b932e6db40c65596b74df8c06d9a7c3a5d759ba2 | 1,322 | py | Python | examples/plot_graph.py | imankulov/gevent-websocket | fbea40aff8e65c5e775ba580fd741cc7f20cbc2b | [
"BSD-3-Clause"
] | 1 | 2015-08-13T05:26:44.000Z | 2015-08-13T05:26:44.000Z | examples/plot_graph.py | imankulov/gevent-websocket | fbea40aff8e65c5e775ba580fd741cc7f20cbc2b | [
"BSD-3-Clause"
] | null | null | null | examples/plot_graph.py | imankulov/gevent-websocket | fbea40aff8e65c5e775ba580fd741cc7f20cbc2b | [
"BSD-3-Clause"
] | null | null | null | """
This example generates random data and plots a graph in the browser.
Run it using Gevent directly using:
$ python plot_grapg.py
Or with an Gunicorn wrapper:
$ gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" \
plot_graph:app
"""
import gevent
import random
from gevent import ... | 24.481481 | 78 | 0.610439 | """
This example generates random data and plots a graph in the browser.
Run it using Gevent directly using:
$ python plot_grapg.py
Or with an Gunicorn wrapper:
$ gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" \
plot_graph:app
"""
import gevent
import os
import random
from geve... | 0 | 0 | 0 | 0 | 0 | 332 | 0 | -12 | 45 |
74ed69e15ef56a87800a1ceb2348219d60cca106 | 3,096 | py | Python | main.py | Grennwolf/Snake-RL- | 320cab8b92c5aae645bd319c416ed59fe5354738 | [
"MIT"
] | null | null | null | main.py | Grennwolf/Snake-RL- | 320cab8b92c5aae645bd319c416ed59fe5354738 | [
"MIT"
] | null | null | null | main.py | Grennwolf/Snake-RL- | 320cab8b92c5aae645bd319c416ed59fe5354738 | [
"MIT"
] | null | null | null | import numpy as np
import game
from nn import NN
env = game.Game(500, 500)
n_state = len(env.reset())
n_actions = env.n_actions
agent = NN(n_state, n_actions)
n_sessions = 100
percentile = 50
log = []
for i in range(50):
#generate new sessions
print(i)
sessions = [generate_session() for... | 32.589474 | 106 | 0.638566 | import numpy as np
import game, time
from nn import NN
env = game.Game(500, 500)
n_state = len(env.reset())
n_actions = env.n_actions
agent = NN(n_state, n_actions)
def generate_session(t_max = 1000):
states, actions = [], []
total_reward = 0
s = env.reset()
for t in range(t_max):
... | 0 | 0 | 0 | 0 | 0 | 1,694 | 0 | 16 | 99 |
8a17bdffa3bbe4e05a0da1c6b18a68f2e5c30b2e | 13,800 | py | Python | myhpom/tests/test_upload_view.py | ResearchSoftwareInstitute/MyHPOM | 2d48fe5ac8d21173b1685eb33059bb391fe24414 | [
"BSD-3-Clause"
] | 1 | 2018-09-17T13:07:29.000Z | 2018-09-17T13:07:29.000Z | myhpom/tests/test_upload_view.py | ResearchSoftwareInstitute/MyHPOM | 2d48fe5ac8d21173b1685eb33059bb391fe24414 | [
"BSD-3-Clause"
] | 100 | 2017-08-01T23:48:04.000Z | 2018-04-03T13:17:27.000Z | myhpom/tests/test_upload_view.py | ResearchSoftwareInstitute/MyHPOM | 2d48fe5ac8d21173b1685eb33059bb391fe24414 | [
"BSD-3-Clause"
] | 1 | 2018-06-28T13:19:58.000Z | 2018-06-28T13:19:58.000Z | import os
PDF_FILENAME = os.path.join(os.path.dirname(__file__), 'fixtures', 'afile.pdf')
| 45.544554 | 94 | 0.700217 | from mock import patch
import os
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings
from django.utils.timezone import now
from myhpom.models import AdvanceDirective
fr... | 0 | 6,812 | 0 | 6,374 | 0 | 0 | 0 | 178 | 338 |
638d1e73d1856f261fec68a5a9e24d845e1161d1 | 3,528 | py | Python | lang-sample/proclang/observer.py | vtheno/Vtools | 5a03891d0c2365602aaae68541f31ba89a6476e5 | [
"MIT"
] | 2 | 2018-04-25T08:59:55.000Z | 2018-04-25T09:53:35.000Z | lang-sample/proclang/observer.py | vtheno/Vtools | 5a03891d0c2365602aaae68541f31ba89a6476e5 | [
"MIT"
] | null | null | null | lang-sample/proclang/observer.py | vtheno/Vtools | 5a03891d0c2365602aaae68541f31ba89a6476e5 | [
"MIT"
] | null | null | null | #coding=utf-8
print( dir() )
# eopl page 80
# value_of : Exp * Env -> ExpVal
if __name__ == '__main__':
test()
repl()
| 30.678261 | 74 | 0.582483 | #coding=utf-8
from util.Match import *
from datatype import *
from env import *
from parse import *
print( dir() )
# eopl page 80
# value_of : Exp * Env -> ExpVal
@matcher(Const_exp,False)
def value_of(self,env):
return Num_val(self.num)
@matcher(Var_exp,False)
def value_of(self,env):
return apply_env(env,self.... | 0 | 1,472 | 0 | 23 | 0 | 1,556 | 0 | -2 | 353 |
dda360e4314501f8a677c72630bd3e219c348f46 | 1,181 | py | Python | rolling/server/document/corpse.py | buxx/rolling | ef1268fe6ddabe768a125c3ce8b37e0b9cbad4a5 | [
"MIT"
] | 14 | 2019-11-16T18:51:51.000Z | 2022-01-15T17:50:34.000Z | rolling/server/document/corpse.py | buxx/rolling | ef1268fe6ddabe768a125c3ce8b37e0b9cbad4a5 | [
"MIT"
] | 148 | 2018-12-10T09:07:45.000Z | 2022-03-08T10:51:04.000Z | rolling/server/document/corpse.py | buxx/rolling | ef1268fe6ddabe768a125c3ce8b37e0b9cbad4a5 | [
"MIT"
] | 1 | 2020-08-05T14:25:48.000Z | 2020-08-05T14:25:48.000Z | # coding: utf-8
| 27.465116 | 84 | 0.723963 | # coding: utf-8
import enum
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import Enum
from sqlalchemy import Integer
from sqlalchemy.ext.declarative import declared_attr
from rolling.server.extension import ServerSideDocument as Document
class AnimatedCorpseType(enum.Enum):
CHARACT... | 0 | 57 | 0 | 782 | 0 | 0 | 0 | 99 | 224 |
1f12be287db7fc7382f094dd4fbc0400f1ab0705 | 851 | py | Python | code/rpi/sample_message.py | SAREC-Lab/birdcall | a597cb361ff5c97467b4b374b1a8cd210b551cf7 | [
"MIT"
] | null | null | null | code/rpi/sample_message.py | SAREC-Lab/birdcall | a597cb361ff5c97467b4b374b1a8cd210b551cf7 | [
"MIT"
] | null | null | null | code/rpi/sample_message.py | SAREC-Lab/birdcall | a597cb361ff5c97467b4b374b1a8cd210b551cf7 | [
"MIT"
] | null | null | null |
import requests
import time
'''
r = requests.post("http://127.0.0.1:5000/commands",
json={'message':'arm'})
print(r.json())
print(r.status_code, r.reason)
'''
while True:
r = requests.get("http://127.0.0.1:5000/status")
print(r.json())
print(r.status_code, r.reason)
time.sleep(1)
... | 25.029412 | 99 | 0.558167 |
import requests
import json
import time
'''
r = requests.post("http://127.0.0.1:5000/commands",
json={'message':'arm'})
print(r.json())
print(r.status_code, r.reason)
'''
while True:
r = requests.get("http://127.0.0.1:5000/status")
print(r.json())
print(r.status_code, r.reason)
tim... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | -10 | 22 |
0b3006d0883d626f388b32ea2e832e3ba597d0a5 | 2,937 | py | Python | spec_util.py | LucasMolander/WoW-APL-Search | 03aa20e18509e9dc4c921e0b47cf58c92ac0f02c | [
"MIT"
] | null | null | null | spec_util.py | LucasMolander/WoW-APL-Search | 03aa20e18509e9dc4c921e0b47cf58c92ac0f02c | [
"MIT"
] | null | null | null | spec_util.py | LucasMolander/WoW-APL-Search | 03aa20e18509e9dc4c921e0b47cf58c92ac0f02c | [
"MIT"
] | null | null | null | from typing import Dict, Set
CLASS_TO_SPECS: Dict[APLClass, Set[APLSpec]] = {
APLClass.WARRIOR: {
APLSpec.WARRIOR_ARMS,
APLSpec.WARRIOR_FURY,
APLSpec.WARRIOR_PROTECTION,
},
APLClass.PALADIN: {
APLSpec.PALADIN_HOLY,
APLSpec.PALADIN_PROTECTION,
APLSpec.PALADIN_RETRIBUTION,
},
APLClass.... | 24.680672 | 48 | 0.721144 | from enum import Enum
from typing import Dict, Set
class APLClass(Enum):
WARRIOR = "warrior"
PALADIN = "paladin"
HUNTER = "hunter"
ROGUE = "rogue"
PRIEST = "priest"
SHAMAN = "shaman"
MAGE = "mage"
WARLOCK = "warlock"
MONK = "monk"
DRUID = "druid"
DEMON_HUNTER = "demon_hunter"
DEATH_KNIGHT = "de... | 0 | 0 | 0 | 1,399 | 0 | 0 | 0 | 0 | 68 |
e6b6b92f8c1a172c27884a8c6754bf7899f73355 | 447 | py | Python | backend/others/large_json_read.py | delone-lora/Shakespeare | c62092bc7307314407ebff4b990116d0583eb8b4 | [
"MIT"
] | null | null | null | backend/others/large_json_read.py | delone-lora/Shakespeare | c62092bc7307314407ebff4b990116d0583eb8b4 | [
"MIT"
] | null | null | null | backend/others/large_json_read.py | delone-lora/Shakespeare | c62092bc7307314407ebff4b990116d0583eb8b4 | [
"MIT"
] | null | null | null | import json
d = []
with open('truncated.json') as json_file:
data = json.load(json_file)
for row in data:
d.append([row["text"], row["user"]["followers_count"]])
print(d[109])
assert False
print(data[0]["user"]["friends_count"])
print(data[3]["user"]["followers_count"])
print(data[1]["user"]["favou... | 26.294118 | 63 | 0.662192 | import json
d = []
with open('truncated.json') as json_file:
data = json.load(json_file)
for row in data:
d.append([row["text"], row["user"]["followers_count"]])
print(d[109])
assert False
print(data[0]["user"]["friends_count"])
print(data[3]["user"]["followers_count"])
print(data[1]["user"]["favou... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
533947edff5bb38f2096fc219acfe72b0d01175a | 4,407 | py | Python | tests/zquantum/core/circuits/_circuit_test.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | null | null | null | tests/zquantum/core/circuits/_circuit_test.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | null | null | null | tests/zquantum/core/circuits/_circuit_test.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | null | null | null | import numpy as np
import sympy
from zquantum.core.circuits._builtin_gates import (CNOT, CPHASE, CZ, ISWAP, PHASE, RX, RY, RZ, SWAP, XX, YY, ZZ, H, I, T, X, Y, Z)
RNG = np.random.default_rng(42)
EXAMPLE_OPERATIONS = tuple(
[
*[gate(qubit_i) for qubit_i in [0, 1, 4] for gate in [X, Y, Z, H, I, T]],
... | 26.709091 | 85 | 0.526208 | import numpy as np
import pytest
import sympy
from zquantum.core.circuits._builtin_gates import (
CNOT,
CPHASE,
CZ,
ISWAP,
PHASE,
RX,
RY,
RZ,
SWAP,
XX,
YY,
ZZ,
H,
I,
T,
X,
Y,
Z,
)
from zquantum.core.circuits._circuit import Circuit
RNG = np.random... | 0 | 221 | 0 | 2,819 | 0 | 141 | 0 | 97 | 136 |
9f7b7888b3f9b6267d86ed87b37a4a236b6d4b63 | 1,961 | py | Python | program05/program05b_kwj_csci160_spr22.py | smallpythoncode/csci160 | 06de335aad28d635995fcf3dc9851ca285e632a1 | [
"MIT"
] | null | null | null | program05/program05b_kwj_csci160_spr22.py | smallpythoncode/csci160 | 06de335aad28d635995fcf3dc9851ca285e632a1 | [
"MIT"
] | null | null | null | program05/program05b_kwj_csci160_spr22.py | smallpythoncode/csci160 | 06de335aad28d635995fcf3dc9851ca285e632a1 | [
"MIT"
] | null | null | null | """
Jahnke
kenny.jahnke@ndus.edu / greensaber77@gmail.com
CSCI 160 - Spring 2022
Program 05, Part B
Use SimpleGraphics to draw your initials. To ensure practice of loops,
only the point command can be used to draw.
"""
setSize(400, 150)
setBackground("black")
setLineWidth(5)
setOutline("lime green")
# start of lett... | 22.54023 | 70 | 0.676186 | """
Jahnke
kenny.jahnke@ndus.edu / greensaber77@gmail.com
CSCI 160 - Spring 2022
Program 05, Part B
Use SimpleGraphics to draw your initials. To ensure practice of loops,
only the point command can be used to draw.
"""
from simple_graphics.SimpleGraphics import *
setSize(400, 150)
setBackground("black")
setLineWidt... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 23 |
60630db64fc6e6369cad59e59022a710af433345 | 4,213 | py | Python | VGG16_keras/VGG16_keras.py | yooookan/yooookan_cnn_practice | 03899d594b254eeb4f960ecd4455399f152bea1b | [
"MIT"
] | null | null | null | VGG16_keras/VGG16_keras.py | yooookan/yooookan_cnn_practice | 03899d594b254eeb4f960ecd4455399f152bea1b | [
"MIT"
] | 15 | 2019-07-23T14:52:25.000Z | 2022-02-10T00:17:10.000Z | VGG16_keras/VGG16_keras.py | yooookan/yooookan_cnn_practice | 03899d594b254eeb4f960ecd4455399f152bea1b | [
"MIT"
] | null | null | null | import keras
from keras.layers import Conv2D, MaxPooling2D, Lambda, Input, Dense, Flatten, BatchNormalization
from keras.models import Model
from keras.layers.core import Dropout
from keras import optimizers
import tensorflow as tf
from keras.callbacks import ReduceLROnPlateau
from sklearn.metrics import confu... | 40.902913 | 97 | 0.651317 | import keras
from keras.layers import Conv2D, MaxPooling2D, Lambda, Input, Dense, Flatten, BatchNormalization
from keras.models import Model
from keras.layers.core import Dropout
from keras import optimizers
import tensorflow as tf
from keras.callbacks import ReduceLROnPlateau,TensorBoard
from sklearn.metrics ... | 42 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 0 |
2266f09a88c36f45aa19a71245e37eb94baed079 | 17,332 | py | Python | Code/slate.py | AspenH/CSC-450-Project | 8f55fda797e13af412a4d70f6f455ad0a1058b69 | [
"MIT"
] | null | null | null | Code/slate.py | AspenH/CSC-450-Project | 8f55fda797e13af412a4d70f6f455ad0a1058b69 | [
"MIT"
] | null | null | null | Code/slate.py | AspenH/CSC-450-Project | 8f55fda797e13af412a4d70f6f455ad0a1058b69 | [
"MIT"
] | null | null | null | """
Project: Project FandRec
Programmed by: David Williams
Last Modified: 11/21/2017
Description: Takes in a frame and finds faces in the picture. If the frame contains a face that has been registered,
it will also check next to the face for fingers held up. If the number of fingers is mapped to action to be
t... | 32.95057 | 815 | 0.678398 | """
Project: Project FandRec
Programmed by: David Williams
Last Modified: 11/21/2017
Description: Takes in a frame and finds faces in the picture. If the frame contains a face that has been registered,
it will also check next to the face for fingers held up. If the number of fingers is mapped to action to be
t... | 0 | 0 | 0 | 6,590 | 213 | 389 | 0 | 125 | 160 |
13dbeff99b9c2ec00df905345823aadbbf822f93 | 496 | py | Python | db.py | stjordanis/owid-importer | 4341713d7fa88b41327ea48419ed5785b5cb9faf | [
"MIT"
] | 15 | 2018-12-07T06:11:49.000Z | 2022-01-24T03:38:05.000Z | db.py | stjordanis/owid-importer | 4341713d7fa88b41327ea48419ed5785b5cb9faf | [
"MIT"
] | 10 | 2020-04-05T01:08:27.000Z | 2022-02-17T23:54:13.000Z | db.py | stjordanis/owid-importer | 4341713d7fa88b41327ea48419ed5785b5cb9faf | [
"MIT"
] | 6 | 2018-11-03T09:14:58.000Z | 2021-05-17T21:59:59.000Z | import os
import pymysql
from dotenv import load_dotenv
load_dotenv()
# Connect to the database
connection = pymysql.connect(db=os.getenv('DB_NAME'),
host=os.getenv('DB_HOST'),
port=int(os.getenv('DB_PORT')),
user=os.getenv('DB_USE... | 35.428571 | 110 | 0.540323 | import os
import pymysql
from dotenv import load_dotenv
load_dotenv()
# Connect to the database
connection = pymysql.connect(db=os.getenv('DB_NAME'),
host=os.getenv('DB_HOST'),
port=int(os.getenv('DB_PORT')),
user=os.getenv('DB_USE... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
aef2700579282b0037f3cfe0e3d864fc97b361ad | 6,360 | py | Python | pyngs/scripts/vcf/allele_filter.py | erasmus-center-for-biomics/pyngs | 3489f91c9c56097a561ae1ff05225f784074228a | [
"MIT"
] | null | null | null | pyngs/scripts/vcf/allele_filter.py | erasmus-center-for-biomics/pyngs | 3489f91c9c56097a561ae1ff05225f784074228a | [
"MIT"
] | null | null | null | pyngs/scripts/vcf/allele_filter.py | erasmus-center-for-biomics/pyngs | 3489f91c9c56097a561ae1ff05225f784074228a | [
"MIT"
] | null | null | null | import argparse
import pyngs.vcf as vcf
from pyngs import open_stream
def allele_filter(args):
"""Run the script."""
fltalleles = FilterAlleles(
samples=args.samples,
alt=args.alternate,
freq=args.frequency,
digits=args.digits,
ploidy=args.ploidy)
w... | 37.411765 | 115 | 0.543868 | import sys
import gzip
import argparse
import logging
from typing import Dict, List, Union, TextIO, Generator
import pyngs.vcf as vcf
from pyngs import open_stream
from pyngs.vcf.tools import FilterAlt
class FilterAlleles:
def __init__(self, samples: List[str], alt:int = 0, freq: float=0.0, digits: i... | 0 | 0 | 0 | 4,319 | 0 | 0 | 0 | 22 | 140 |
c47c6fe3d9583375ad87bd533dcc56d5a32c9bae | 596 | py | Python | GT/GT_app/views.py | 10K-Linesofcode/Glowing-Tribble | be0e17ce5391b589792e4ae6b02156d7ee4ce145 | [
"MIT"
] | null | null | null | GT/GT_app/views.py | 10K-Linesofcode/Glowing-Tribble | be0e17ce5391b589792e4ae6b02156d7ee4ce145 | [
"MIT"
] | null | null | null | GT/GT_app/views.py | 10K-Linesofcode/Glowing-Tribble | be0e17ce5391b589792e4ae6b02156d7ee4ce145 | [
"MIT"
] | null | null | null |
# Create your views here.
# Create your views here.
#def index(request):
# return HttpResponse(' Hello World')
# pass
#def index_withTemplate(request):
# insert_dict= {'insert_me':'Hello im comming from views.py'}
# return render(request,'index.html',insert_dict)
| 27.090909 | 65 | 0.746644 | from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from GT_app.models import Topic,Webpage,AccessRecord
# Create your views here.
#def index(request):
# return HttpResponse(' Hello World')
# pass
def index(request):
webpages_list = AccessRecord.objects.or... | 0 | 0 | 0 | 0 | 0 | 163 | 0 | 60 | 89 |
f65ae266878a3c8b2ea3208da278c2a7c7afa863 | 6,451 | py | Python | examples/local/run_pt_dataset_local_example.py | bhky/targetran | ae836949448c383d58bb5b5ce70b3a4547f32102 | [
"MIT"
] | 13 | 2021-08-29T19:18:27.000Z | 2022-03-22T02:21:30.000Z | examples/local/run_pt_dataset_local_example.py | bhky/targetran | ae836949448c383d58bb5b5ce70b3a4547f32102 | [
"MIT"
] | null | null | null | examples/local/run_pt_dataset_local_example.py | bhky/targetran | ae836949448c383d58bb5b5ce70b3a4547f32102 | [
"MIT"
] | 2 | 2021-11-10T06:12:54.000Z | 2021-11-10T20:16:14.000Z | #!/usr/bin/env python3
"""
PyTorch Dataset local example.
"""
import glob
import json
import os
from typing import Dict, List, Optional, Tuple
import cv2
import matplotlib.pylab as plt
import numpy as np
import numpy.typing
from torch.utils.data import Dataset
from targetran.utils import Compose
NDAnyArray = np.typi... | 27.926407 | 79 | 0.602697 | #!/usr/bin/env python3
"""
PyTorch Dataset local example.
"""
import glob
import json
import os
from typing import Dict, List, Optional, Sequence, Tuple
import cv2
import matplotlib.pylab as plt
import numpy as np
import numpy.typing
from torch.utils.data import Dataset, DataLoader
from targetran.np import (
Com... | 0 | 0 | 0 | 993 | 0 | 1,592 | 0 | 169 | 69 |
51624b6789e3f19fd8a238c3b0b912a8efd7ec89 | 2,484 | py | Python | dataset.py | t-zhong/DeepComplexCRN | ecde09722d6ca441c3cc9ee57cf15cf4ae083750 | [
"Apache-2.0"
] | null | null | null | dataset.py | t-zhong/DeepComplexCRN | ecde09722d6ca441c3cc9ee57cf15cf4ae083750 | [
"Apache-2.0"
] | null | null | null | dataset.py | t-zhong/DeepComplexCRN | ecde09722d6ca441c3cc9ee57cf15cf4ae083750 | [
"Apache-2.0"
] | null | null | null | #
if __name__ == '__main__':
from torch.utils.data import DataLoader
trainset = WavDataset('../data/trunc_noisy_train2', '../data/trunc_speech_train')
trainloader = DataLoader(trainset)
for _ in trainloader:
pass
| 33.12 | 104 | 0.663446 | # 数据集
import os
import glob
import librosa
import numpy as np
import torch
from torch.utils.data import Dataset
def _load_wav(path, frame_dur, sr=16000):
y, _ = librosa.load(path, sr=sr)
# win = int(frame_dur / 1000 * sr)
# return torch.tensor(np.split(y, int(len(y) / win), axis=0))
return y
class... | 9 | 0 | 0 | 1,410 | 0 | 618 | 0 | -26 | 226 |
79ce563f9bd2520490e0bac569dee84da256801d | 2,197 | py | Python | yabgp/tests/unit/message/attribute/nlri/test_mpls_vpn.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 203 | 2015-05-15T12:07:30.000Z | 2022-03-13T16:36:03.000Z | yabgp/tests/unit/message/attribute/nlri/test_mpls_vpn.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 109 | 2015-05-19T16:07:59.000Z | 2022-03-09T08:18:23.000Z | yabgp/tests/unit/message/attribute/nlri/test_mpls_vpn.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 74 | 2015-05-14T15:24:10.000Z | 2022-03-09T06:21:51.000Z | # Copyright 2016 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 37.237288 | 84 | 0.702321 | # Copyright 2016 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 0 | 0 | 0 | 1,392 | 0 | 0 | 0 | 36 | 46 |
bca109701e1f543c9dcb2beb37c4a08a6bd7a1d2 | 2,240 | py | Python | bot.py | E2r7hN07Fl47/Telegram-VideoToGif | 7a00f35d874267ac1852a9e14718695589dc2d65 | [
"MIT"
] | null | null | null | bot.py | E2r7hN07Fl47/Telegram-VideoToGif | 7a00f35d874267ac1852a9e14718695589dc2d65 | [
"MIT"
] | null | null | null | bot.py | E2r7hN07Fl47/Telegram-VideoToGif | 7a00f35d874267ac1852a9e14718695589dc2d65 | [
"MIT"
] | 1 | 2021-12-21T00:47:09.000Z | 2021-12-21T00:47:09.000Z | import json
from aiogram import Bot
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
with open("config.json", encoding='UTF-8') as file:
config = json.load(file)
token = config["token"]
bot = Bot(token=token)
dp = Dispatcher(bot)
if __name__ == "__main__":
executor.start_polli... | 31.111111 | 101 | 0.708929 | import traceback
import os
import json
import asyncio
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.types.message import ContentType
from aiogram.utils import executor
from moviepy.editor import VideoFileClip
from moviepy.video.fx.resize import resize
from aiogram.utils.exception... | 0 | 1,319 | 0 | 0 | 0 | 273 | 0 | 75 | 246 |
0498924440d37ccdf6502ff34e4571a8f301fb3e | 2,482 | py | Python | release_watcher/watchers/watcher_manager.py | ExternalRepositories/release-watcher | b282d63d9887f16ab509a2223e3807c0a0b402ee | [
"MIT"
] | null | null | null | release_watcher/watchers/watcher_manager.py | ExternalRepositories/release-watcher | b282d63d9887f16ab509a2223e3807c0a0b402ee | [
"MIT"
] | null | null | null | release_watcher/watchers/watcher_manager.py | ExternalRepositories/release-watcher | b282d63d9887f16ab509a2223e3807c0a0b402ee | [
"MIT"
] | 1 | 2021-02-27T23:32:09.000Z | 2021-02-27T23:32:09.000Z | import logging
logger = logging.getLogger(__name__)
WATCHER_TYPES = {}
def register_watcher_type(watcher_type: WatcherType):
"""Regiters an WatcherType to enable using it by name later"""
logger.info("Registering watcher type : %s", watcher_type.name)
WATCHER_TYPES[watcher_type.name] = watcher_type
... | 29.2 | 79 | 0.663578 | import logging
import abc
import time
from typing import Dict
from release_watcher.base_models import WatcherConfig
from release_watcher.config_models import CommonConfig
from release_watcher.watchers.watcher_models import WatchResult
logger = logging.getLogger(__name__)
WATCHER_TYPES = {}
class Watcher(metaclass=a... | 0 | 420 | 0 | 1,223 | 0 | 0 | 0 | 88 | 178 |
86163464e90840938537a29e4ce3f90f1b0ff47f | 4,806 | py | Python | src/step2_entity_linking.py | lychyzclc/High-throughput-relation-extraction-algorithm | 93530ddcb78df3f1b1b7fda34821fa307d095c74 | [
"MIT"
] | 1 | 2021-01-04T03:15:50.000Z | 2021-01-04T03:15:50.000Z | src/step2_entity_linking.py | lychyzclc/High-throughput-relation-extraction-algorithm | 93530ddcb78df3f1b1b7fda34821fa307d095c74 | [
"MIT"
] | null | null | null | src/step2_entity_linking.py | lychyzclc/High-throughput-relation-extraction-algorithm | 93530ddcb78df3f1b1b7fda34821fa307d095c74 | [
"MIT"
] | null | null | null | import argparse
import logging
import os
from multiprocessing import Process
from util.logger import get_logger
from util.trie import Trie
logger = logging.getLogger(__name__)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--input_file',
type=str... | 36.135338 | 99 | 0.571577 | import argparse
import logging
import os
from multiprocessing import Process
from tqdm import tqdm
from util.load_sentence import LoadSentences
from util.logger import get_logger
from util.trie import Trie, TrieMatchResult, TrieNode
logger = logging.getLogger(__name__)
class NERresult:
def __init__(self, art_i... | 0 | 0 | 0 | 2,676 | 0 | 254 | 0 | 50 | 115 |
7863eafa7620fb63043e04713e5af35bd97959ff | 1,143 | py | Python | PyMOTW/source/sys/sys_settrace_line.py | axetang/AxePython | 3b517fa3123ce2e939680ad1ae14f7e602d446a6 | [
"Apache-2.0"
] | 1 | 2019-01-04T05:47:50.000Z | 2019-01-04T05:47:50.000Z | PyMOTW/source/sys/sys_settrace_line.py | axetang/AxePython | 3b517fa3123ce2e939680ad1ae14f7e602d446a6 | [
"Apache-2.0"
] | 1 | 2020-07-18T03:52:03.000Z | 2020-07-18T04:18:01.000Z | PyMOTW/source/sys/sys_settrace_line.py | axetang/AxePython | 3b517fa3123ce2e939680ad1ae14f7e602d446a6 | [
"Apache-2.0"
] | 2 | 2021-03-06T04:28:32.000Z | 2021-03-06T04:59:17.000Z | #!/usr/bin/env python3
# encoding: utf-8
import functools
import sys
tracer = functools.partial(trace_calls, to_be_traced=['b'])
sys.settrace(tracer)
a()
| 20.052632 | 59 | 0.609799 | #!/usr/bin/env python3
# encoding: utf-8
import functools
import sys
def trace_lines(frame, event, arg):
if event != 'line':
return
co = frame.f_code
func_name = co.co_name
line_no = frame.f_lineno
print('* {} line {}'.format(func_name, line_no))
def trace_calls(frame, event, arg, to_b... | 0 | 0 | 0 | 0 | 0 | 866 | 0 | 0 | 115 |
2f15b3b662010e584721b099ffb01d6a409b67d2 | 463 | py | Python | scripts/cool_btc_address.py | mckev/bitcoin | a54f9732d59577757729f57c44867afe870b89e7 | [
"MIT"
] | null | null | null | scripts/cool_btc_address.py | mckev/bitcoin | a54f9732d59577757729f57c44867afe870b89e7 | [
"MIT"
] | null | null | null | scripts/cool_btc_address.py | mckev/bitcoin | a54f9732d59577757729f57c44867afe870b89e7 | [
"MIT"
] | null | null | null | """
Generate BTC addresses which have predefined prefix.
"""
import secrets
from classes.btc_address import BtcAddress
while True:
btc_private_key = secrets.token_bytes(nbytes=32)
btc_address = BtcAddress.compute_btc_address(btc_private_key)
if btc_address.lower().startswith('1kev'):
btc_private_... | 30.866667 | 93 | 0.768898 | """
Generate BTC addresses which have predefined prefix.
"""
import secrets
from classes.btc_address import BtcAddress
while True:
btc_private_key = secrets.token_bytes(nbytes=32)
btc_address = BtcAddress.compute_btc_address(btc_private_key)
if btc_address.lower().startswith('1kev'):
btc_private_... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
8151faca9e56db01bcc3af5654bf9283a26c0436 | 3,162 | py | Python | tests/test_dats_validator.py | mathdugre/conp-dataset | f117b9a2f8191d654de6d3aad57e6c352a6e881e | [
"MIT"
] | null | null | null | tests/test_dats_validator.py | mathdugre/conp-dataset | f117b9a2f8191d654de6d3aad57e6c352a6e881e | [
"MIT"
] | null | null | null | tests/test_dats_validator.py | mathdugre/conp-dataset | f117b9a2f8191d654de6d3aad57e6c352a6e881e | [
"MIT"
] | null | null | null | import unittest
import json
import os
import sys
sys.path.append(os.path.join(os.getcwd(), 'scripts'))
EXAMPLES = os.path.join(os.getcwd(), 'scripts', 'dats_validator', 'examples')
VALID = os.path.join(EXAMPLES, 'valid_dats.json')
INVALID = os.path.join(EXAMPLES, 'invalid_dats.json')
with open(VALID) as v_file:
... | 37.2 | 109 | 0.645161 | import unittest
import json
import os
import sys
import copy
sys.path.append(os.path.join(os.getcwd(), 'scripts'))
from dats_validator.validator import (validate_json, # noqa: E402
validate_non_schema_required,
validate_extra_properties,
... | 0 | 0 | 0 | 2,327 | 0 | 0 | 0 | 272 | 90 |
b2add9d9fcdf80d93800980efa78940fd72dd658 | 2,845 | py | Python | board.py | imarrero1/CSC_120_Tic_Tac_Toe | b798282dc8a2ae9f3886d7579e4352946d02fe67 | [
"MIT"
] | null | null | null | board.py | imarrero1/CSC_120_Tic_Tac_Toe | b798282dc8a2ae9f3886d7579e4352946d02fe67 | [
"MIT"
] | null | null | null | board.py | imarrero1/CSC_120_Tic_Tac_Toe | b798282dc8a2ae9f3886d7579e4352946d02fe67 | [
"MIT"
] | null | null | null | # Global Variables
board = ["-", "-", "-",
"-", "-", "-",
"-", "-", "-"]
player_id = "X"
continue_game = True
winner = None
#Functions
# Starts the game
game()
| 18.966667 | 105 | 0.609842 | # Global Variables
board = ["-", "-", "-",
"-", "-", "-",
"-", "-", "-"]
player_id = "X"
continue_game = True
winner = None
#Functions
def print_board():
print(board[0], board[1], board[2])
print(board[3], board[4], board[5])
print(board[6], board[7], board[8])
def game():
print_board()
... | 0 | 0 | 0 | 0 | 0 | 2,425 | 0 | 0 | 229 |
a9e6d46ec4bfcae93d5e63075494036f6989a034 | 1,543 | py | Python | src/day006.py | zhangxinyong12/my-python-demo | 3ac121073749ad9caf42531603e921b04e1e7c6c | [
"MIT"
] | null | null | null | src/day006.py | zhangxinyong12/my-python-demo | 3ac121073749ad9caf42531603e921b04e1e7c6c | [
"MIT"
] | null | null | null | src/day006.py | zhangxinyong12/my-python-demo | 3ac121073749ad9caf42531603e921b04e1e7c6c | [
"MIT"
] | null | null | null | # #
# def func():
# n = 0
# while True:
# n += 1
# yield n # yield = return +
#
#
# # g = func()
# # print(g)
# # print(g.__next__())
# # print(next(g))
#
#
# def fid(length):
# a, b = 0, 1
# n = 0
# while n < length:
# yield b
# a, b = b, a + b
# n += 1
# ... | 14.420561 | 43 | 0.48477 | # #
# def func():
# n = 0
# while True:
# n += 1
# yield n # yield = return + 暂停
#
#
# # g = func()
# # print(g)
# # print(g.__next__())
# # print(next(g))
#
#
# def fid(length):
# a, b = 0, 1
# n = 0
# while n < length:
# yield b
# a, b = b, a + b
# n += 1
#... | 165 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
7a70c72440606d7ad6fd4ad48ab4652557312e50 | 248 | py | Python | Intermediate/collections_deque.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | Intermediate/collections_deque.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | Intermediate/collections_deque.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | # collections deque nr8
from collections import deque
d = deque("hello", maxlen=5)
d.extend([1, 2, 3])
# d.pop()
# d.popleft()
# d.clear()
# d.extend("456")
# d.extend([1, 2, 3])
# d.extendleft("hey")
# d.rotate(-2)
print(d)
| 13.777778 | 29 | 0.629032 | # collections deque nr8
import collections
from collections import deque
d = deque("hello", maxlen=5)
d.extend([1, 2, 3])
# d.pop()
# d.popleft()
# d.clear()
# d.extend("456")
# d.extend([1, 2, 3])
# d.extendleft("hey")
# d.rotate(-2)
print(d)
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | -3 | 22 |
9b0072e1e89c9a499d1082c31c74942345dc50ae | 1,732 | py | Python | torch_utils.py | hducg/B-Rep_GNN | 086cca1e6ea7b2d05e99823d32d88c266634cc52 | [
"MIT"
] | 1 | 2021-12-05T13:20:43.000Z | 2021-12-05T13:20:43.000Z | torch_utils.py | hducg/B-Rep_GNN | 086cca1e6ea7b2d05e99823d32d88c266634cc52 | [
"MIT"
] | null | null | null | torch_utils.py | hducg/B-Rep_GNN | 086cca1e6ea7b2d05e99823d32d88c266634cc52 | [
"MIT"
] | 1 | 2021-11-13T04:24:46.000Z | 2021-11-13T04:24:46.000Z | import os
import shutil
import torch
def save_checkpoint(state, is_best, checkpoint):
"""Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves
checkpoint + 'best.pth.tar'
Args:
state: (dict) contains model's state_dict, may contain other keys s... | 39.363636 | 110 | 0.683603 | import os
import shutil
import torch
def save_checkpoint(state, is_best, checkpoint):
"""Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves
checkpoint + 'best.pth.tar'
Args:
state: (dict) contains model's state_dict, may contain other keys s... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0acaabfad8f8c6529659fa2cf3057c09bfb33096 | 336 | py | Python | exercícios/EX_CursoEmVideo/ex063.py | jose-carlos-code/CursoEmvideo-python | 8c9b82db2c2b906f6d8f2359a680b9b3af25da43 | [
"MIT"
] | 1 | 2021-01-11T15:10:36.000Z | 2021-01-11T15:10:36.000Z | exercícios/EX_CursoEmVideo/ex063.py | jose-carlos-code/CursoEmvideo-python | 8c9b82db2c2b906f6d8f2359a680b9b3af25da43 | [
"MIT"
] | null | null | null | exercícios/EX_CursoEmVideo/ex063.py | jose-carlos-code/CursoEmvideo-python | 8c9b82db2c2b906f6d8f2359a680b9b3af25da43 | [
"MIT"
] | null | null | null | print('-'*30)
print('sequencia de fibonacci')
print('-'*30)
n = int(input('quantos termos voce quer mostrar?: '))
t1 = 0
t2 = 1
print('~'*30)
print(f'{t1} - {t2}', end='')
contador = 3
while contador <= n:
t3 = t1 + t2
print(f' - {t3}', end='')
t1 = t2
t2 = t3
contador = contador + 1
print(' - FIM',... | 19.764706 | 53 | 0.541667 | print('-'*30)
print('sequencia de fibonacci')
print('-'*30)
n = int(input('quantos termos voce quer mostrar?: '))
t1 = 0
t2 = 1
print('~'*30)
print(f'{t1} - {t2}', end='')
contador = 3
while contador <= n:
t3 = t1 + t2
print(f' - {t3}', end='')
t1 = t2
t2 = t3
contador = contador + 1
print(' - FIM',... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
b783f6e20b4940d15fb2deccfb44b27e44332116 | 2,468 | py | Python | isi_sdk_8_0_1/test/test_network_api.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 24 | 2018-06-22T14:13:23.000Z | 2022-03-23T01:21:26.000Z | isi_sdk_8_0_1/test/test_network_api.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 46 | 2018-04-30T13:28:22.000Z | 2022-03-21T21:11:07.000Z | isi_sdk_8_0_1/test/test_network_api.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 29 | 2018-06-19T00:14:04.000Z | 2022-02-08T17:51:19.000Z | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
if __name__ == '__main__'... | 19.744 | 75 | 0.632901 | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0_1
from i... | 0 | 0 | 0 | 1,970 | 0 | 0 | 0 | 52 | 104 |
5dfe3859a209225ebe068a26db8a59291cc643d2 | 4,802 | py | Python | azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | null | null | null | azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | null | null | null | azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | null | null | null | # 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 ... | 45.733333 | 259 | 0.645564 | # 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 ... | 0 | 0 | 0 | 4,258 | 0 | 0 | 0 | 24 | 46 |
803452b399dc96ace5eba36cc53db3135af8c253 | 5,876 | py | Python | ucsmsdk/mometa/lstorage/LstorageVirtualDriveDef.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 78 | 2015-11-30T14:10:05.000Z | 2022-02-13T00:29:08.000Z | ucsmsdk/mometa/lstorage/LstorageVirtualDriveDef.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 113 | 2015-11-20T09:42:46.000Z | 2022-03-16T16:53:29.000Z | ucsmsdk/mometa/lstorage/LstorageVirtualDriveDef.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 86 | 2015-12-12T08:22:18.000Z | 2022-01-23T03:56:34.000Z | """This module contains the general information for LstorageVirtualDriveDef ManagedObject."""
| 57.607843 | 361 | 0.689074 | """This module contains the general information for LstorageVirtualDriveDef ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class LstorageVirtualDriveDefConsts:
ACCESS_POLICY_BLOCKED = "blocked"
ACCESS_POLICY_HIDDEN = "... | 0 | 0 | 0 | 5,613 | 0 | 0 | 0 | 54 | 113 |
cb661003040114eccc210b0aee65b2157f6132d3 | 281 | py | Python | ABC/abc201-abc250/abc229/a/main.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 2 | 2020-06-12T09:54:23.000Z | 2021-05-04T01:34:07.000Z | ABC/abc201-abc250/abc229/a/main.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 961 | 2020-06-23T07:26:22.000Z | 2022-03-31T21:34:52.000Z | ABC/abc201-abc250/abc229/a/main.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
if __name__ == "__main__":
main()
| 13.380952 | 34 | 0.44484 | # -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
s1 = input().rstrip()
s2 = input().rstrip()
s = s1 + s2
if s == "#..#" or s == ".##.":
print("No")
else:
print("Yes")
if __name__ == "__main__":
main()
| 0 | 0 | 0 | 0 | 0 | 193 | 0 | 0 | 23 |
0aaf918a1828edf2b790185e1b5ccfbbdc3886c6 | 13,408 | py | Python | venv/Lib/site-packages/setuptools/_distutils/filelist.py | camehu2022/cotacao_moeda | 0f161b58184c783e64b76803596862c45fb4a947 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/setuptools/_distutils/filelist.py | camehu2022/cotacao_moeda | 0f161b58184c783e64b76803596862c45fb4a947 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/setuptools/_distutils/filelist.py | camehu2022/cotacao_moeda | 0f161b58184c783e64b76803596862c45fb4a947 | [
"MIT"
] | null | null | null | """distutils.filelist
Provides the FileList class, used for poking about the filesystem
and building lists of files.
"""
import os
import re
import fnmatch
import functools
# Utility functions
def _find_all_simple(path):
"""
Find all files under 'path'
"""
all_unique = _UniqueDirs.filter(os.walk(p... | 37.662921 | 79 | 0.589499 | """distutils.filelist
Provides the FileList class, used for poking about the filesystem
and building lists of files.
"""
import os
import re
import fnmatch
import functools
from distutils.util import convert_path
from distutils.errors import DistutilsTemplateError, DistutilsInternalError
from distutils import log
... | 0 | 55 | 0 | 9,947 | 0 | 0 | 0 | 76 | 113 |
3e00ff2da4b4364bb00b8b901f1ed02a664066fc | 264 | py | Python | smsbrana/urls.py | bstepa/django-smsbrana | e8ea56366a848a2eebfb70133d9f7883b0c48651 | [
"BSD-3-Clause"
] | 4 | 2015-06-10T16:20:01.000Z | 2016-03-16T19:36:13.000Z | smsbrana/urls.py | bstepa/django-smsbrana | e8ea56366a848a2eebfb70133d9f7883b0c48651 | [
"BSD-3-Clause"
] | 1 | 2016-07-25T16:30:17.000Z | 2020-10-01T12:11:57.000Z | smsbrana/urls.py | bstepa/django-smsbrana | e8ea56366a848a2eebfb70133d9f7883b0c48651 | [
"BSD-3-Clause"
] | 1 | 2015-10-19T22:56:42.000Z | 2015-10-19T22:56:42.000Z | # -*- coding: utf-8 -*-
try:
from django.conf.urls import url
except ImportError:
from django.conf.urls.defaults import url
from . import views
urlpatterns = [
url(r'^notification/$', views.smsconnect_notification, name='smsconnect_notification'),
]
| 22 | 91 | 0.715909 | # -*- coding: utf-8 -*-
try:
from django.conf.urls import url
except ImportError:
from django.conf.urls.defaults import url
from . import views
urlpatterns = [
url(r'^notification/$', views.smsconnect_notification, name='smsconnect_notification'),
]
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3cd9b7222131320bda8b7ed69581336029b963d9 | 2,192 | py | Python | appengine/components/components/auth/config.py | pombreda/swarming | c70f311f3db8f25752c793a0d7b36cf537d95580 | [
"Apache-2.0"
] | null | null | null | appengine/components/components/auth/config.py | pombreda/swarming | c70f311f3db8f25752c793a0d7b36cf537d95580 | [
"Apache-2.0"
] | null | null | null | appengine/components/components/auth/config.py | pombreda/swarming | c70f311f3db8f25752c793a0d7b36cf537d95580 | [
"Apache-2.0"
] | 1 | 2021-12-06T03:37:36.000Z | 2021-12-06T03:37:36.000Z | # Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Auth component configuration hooks.
Application that use 'auth' component can override settings defined here by
adding the following lines to appengi... | 31.314286 | 78 | 0.734033 | # Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Auth component configuration hooks.
Application that use 'auth' component can override settings defined here by
adding the following lines to appengi... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4bd33c51fd680443d897479f80753de2a7a98445 | 490 | py | Python | ORM/configs.py | LenoxWong/simpleORM | 6f8eaabe41a6d6384b4c9bcc07ee26fa7bf78a92 | [
"MIT"
] | null | null | null | ORM/configs.py | LenoxWong/simpleORM | 6f8eaabe41a6d6384b4c9bcc07ee26fa7bf78a92 | [
"MIT"
] | null | null | null | ORM/configs.py | LenoxWong/simpleORM | 6f8eaabe41a6d6384b4c9bcc07ee26fa7bf78a92 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'LenoxWong'
# for creating database
database = {
'name': 'Test',
'host': 'localhost',
'user': 'test',
'password': 'test'
},
# for creating the pool
pool = {
'host': 'localhost',
'port': 3306,
'user': tuple(database)[0]['user'],
... | 18.846154 | 47 | 0.55102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'LenoxWong'
# for creating database
database = {
'name': 'Test',
'host': 'localhost',
'user': 'test',
'password': 'test'
},
# for creating the pool
pool = {
'host': 'localhost',
'port': 3306,
'user': tuple(database)[0]['user'],
... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
a7431d81a46af507ae6ff0b228df3d99848aa2fb | 1,682 | py | Python | src/05_landcover/01_compute_proportions.py | ranarango/fuegos-orinoquia | d82941ef0c90fe66162c8678b6f4a4c010d4313b | [
"MIT"
] | null | null | null | src/05_landcover/01_compute_proportions.py | ranarango/fuegos-orinoquia | d82941ef0c90fe66162c8678b6f4a4c010d4313b | [
"MIT"
] | null | null | null | src/05_landcover/01_compute_proportions.py | ranarango/fuegos-orinoquia | d82941ef0c90fe66162c8678b6f4a4c010d4313b | [
"MIT"
] | null | null | null | """
"""
import os
import numpy as np
import pandas as pd
import xarray as xr
from osgeo import gdal
from src.utils.constants import (REGIONS, LANDCOVER_MAP, LANDCOVER_PERIODS, LANDCOVER_PADDING)
if __name__ == "__main__":
# Project's root
os.chdir("../..")
for region in REGIONS:
region_name ... | 29.508772 | 82 | 0.604043 | """
"""
import os
import numpy as np
import pandas as pd
import xarray as xr
from osgeo import gdal
from src.utils.constants import (
REGIONS,
LANDCOVER_MAP,
LANDCOVER_PERIODS,
LANDCOVER_PADDING
)
if __name__ == "__main__":
# Project's root
os.chdir("../..")
for region in REGIONS:
... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 0 |
f00607d5de898c0a5f408b092be12ec1b500cea9 | 4,030 | py | Python | pa/calc_spectra.py | mlipatov/paint_atmospheres | 75b494010a728e0682645de739752ff20a47d717 | [
"MIT"
] | 4 | 2020-07-28T08:06:07.000Z | 2020-08-01T04:25:32.000Z | pa/calc_spectra.py | mlipatov/paint_atmospheres | 75b494010a728e0682645de739752ff20a47d717 | [
"MIT"
] | null | null | null | pa/calc_spectra.py | mlipatov/paint_atmospheres | 75b494010a728e0682645de739752ff20a47d717 | [
"MIT"
] | null | null | null | # calculates spectra of a given star at different inclinations
# in case we are running this file as the main program
if __name__ == "__main__":
run() | 34.741379 | 111 | 0.656576 | # calculates spectra of a given star at different inclinations
from pa.lib import limbdark
from pa.lib import fit as ft
from pa.lib import star
from pa.lib import util as ut
import numpy as np
from numpy.core import defchararray as ch
import sys
import time
import argparse
import pickle
import os
def run():
parser = ... | 0 | 0 | 0 | 0 | 0 | 3,618 | 0 | -7 | 265 |
533c281b9935449bfa470f9fe5904c7c97f5aff9 | 4,582 | py | Python | tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/sharded_mutable_dense_hashtable_test.py | burgerkingeater/estimator | 4c38177f1a842d2169f90e1095f85e49e794a564 | [
"Apache-2.0"
] | 288 | 2018-10-10T14:35:11.000Z | 2022-03-26T14:49:13.000Z | tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/sharded_mutable_dense_hashtable_test.py | burgerkingeater/estimator | 4c38177f1a842d2169f90e1095f85e49e794a564 | [
"Apache-2.0"
] | 49 | 2018-10-19T08:49:10.000Z | 2021-11-23T02:52:04.000Z | tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/sharded_mutable_dense_hashtable_test.py | burgerkingeater/estimator | 4c38177f1a842d2169f90e1095f85e49e794a564 | [
"Apache-2.0"
] | 228 | 2018-10-10T14:41:08.000Z | 2022-03-28T10:54:05.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... | 38.183333 | 148 | 0.629201 | # 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... | 0 | 0 | 0 | 3,434 | 0 | 0 | 0 | 129 | 68 |
46daf1c20cac94292d8ca272a96258554d245961 | 32,653 | py | Python | teapal-backend/qa/views.py | LGU-Starup/TeaPal-Proj | 242d61786dc792fe924b3e697c9635ca9dd672be | [
"MIT"
] | null | null | null | teapal-backend/qa/views.py | LGU-Starup/TeaPal-Proj | 242d61786dc792fe924b3e697c9635ca9dd672be | [
"MIT"
] | null | null | null | teapal-backend/qa/views.py | LGU-Starup/TeaPal-Proj | 242d61786dc792fe924b3e697c9635ca9dd672be | [
"MIT"
] | null | null | null | from django.http import JsonResponse, HttpResponse
from sts.sts import Sts
from qa.cos import settings as cos_settings
TOKEN_LENGTH = 50
TOKEN_DURING_DAYS = 15
# predefined HttpResponse
RESPONSE_INVALID_PARAM = HttpResponse(content="Invalid parameter", status=400, reason="I-PAR")
RESPONSE_BLANK_PARAM = HttpResponse(c... | 37.446101 | 136 | 0.635286 | import collections
from django.shortcuts import get_object_or_404
from django.http import JsonResponse, HttpResponse
from .models import *
from django.db.utils import IntegrityError
from django.views.decorators.http import require_http_methods
from django.forms.models import model_to_dict
from itertools import chain
fr... | 759 | 24,857 | 0 | 0 | 0 | 2,125 | 0 | 249 | 1,196 |
fa3287451859fbbd8f63533dcfe9c458aef5e239 | 1,295 | py | Python | dev/profiling/profiling-versus-bw2.py | mixib/matrix_utils | 6e59f4179980d705face350d839ca4bd951e3c3c | [
"BSD-3-Clause"
] | 1 | 2021-02-22T11:57:43.000Z | 2021-02-22T11:57:43.000Z | dev/profiling/profiling-versus-bw2.py | mixib/matrix_utils | 6e59f4179980d705face350d839ca4bd951e3c3c | [
"BSD-3-Clause"
] | 5 | 2021-05-27T13:08:42.000Z | 2021-11-01T20:52:55.000Z | dev/profiling/profiling-versus-bw2.py | mixib/matrix_utils | 6e59f4179980d705face350d839ca4bd951e3c3c | [
"BSD-3-Clause"
] | 2 | 2021-06-14T09:04:08.000Z | 2021-09-17T12:30:36.000Z | from functools import partial
# Code for bw2
import bw2data as bd, bw2calc as bc
bd.projects.set_current("ecoinvent 3.7.1 bw2")
bd.databases
a = bd.get_activity(('ecoinvent 3.7.1', 'f57568b2e553864152a6ac920595216f'))
a
ipcc = ('IPCC 2013', 'climate change', 'GWP 100a')
curry = partial(bc.LCA, demand={a: 1}, ... | 23.125 | 104 | 0.705792 | from functools import partial
import psutil
import time
def run_curried_lca(func):
lca = func()
lca.lci()
lca.lcia()
print(lca.score)
def profile_func(func):
# Logging code adapted from https://github.com/rasbt/pyprind/blob/master/pyprind/prog_class.py
start = time.time()
process = psuti... | 0 | 0 | 0 | 0 | 0 | 425 | 0 | -18 | 90 |
14db163e8d3bf528c299b62c698afda85435885e | 861 | py | Python | simple_pubsub_python/simple_pubsub_python/natural_number_generator.py | jyhh1992/test_ros2 | 98c70b6012ab11a51f5ac3792a4cbdc8b28a5a28 | [
"Apache-2.0"
] | null | null | null | simple_pubsub_python/simple_pubsub_python/natural_number_generator.py | jyhh1992/test_ros2 | 98c70b6012ab11a51f5ac3792a4cbdc8b28a5a28 | [
"Apache-2.0"
] | null | null | null | simple_pubsub_python/simple_pubsub_python/natural_number_generator.py | jyhh1992/test_ros2 | 98c70b6012ab11a51f5ac3792a4cbdc8b28a5a28 | [
"Apache-2.0"
] | null | null | null |
if __name__ == '__main__':
main() | 26.90625 | 83 | 0.684088 | import rclpy
from rclpy.node import Node
from std_msgs.msg import Int64
class NaturalNumberGenerator(Node):
def __init__(self):
super().__init__('natural_number_genertor')
self.publisher_ = self.create_publisher(Int64, 'natural_number_signal', 10)
timer_period = 3
self.timer = sel... | 0 | 0 | 0 | 518 | 0 | 185 | 0 | 6 | 113 |
6d45a10e0e375e6e1f3c88aada3b9c599761cd62 | 491 | py | Python | easy/2D_array.py | YANG007SUN/hackerrank_challenge | 0c055c9e5129f1625fe86174435a89c141d256d6 | [
"Apache-2.0"
] | null | null | null | easy/2D_array.py | YANG007SUN/hackerrank_challenge | 0c055c9e5129f1625fe86174435a89c141d256d6 | [
"Apache-2.0"
] | null | null | null | easy/2D_array.py | YANG007SUN/hackerrank_challenge | 0c055c9e5129f1625fe86174435a89c141d256d6 | [
"Apache-2.0"
] | null | null | null | # https://www.hackerrank.com/challenges/2d-array/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays
arr = []
for _ in range(6):
arr.append(list(map(int, input().rstrip().split())))
hourglassSum(arr) | 30.6875 | 145 | 0.627291 | # https://www.hackerrank.com/challenges/2d-array/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays
def hourglassSum(arr):
results = []
for i in range(4):
for j in range(4):
results.append(arr[i][j]+arr[i][j+1]+arr[i][j+2]+arr[i+1][j+1]+arr[i+2]... | 0 | 0 | 0 | 0 | 0 | 217 | 0 | 0 | 23 |
b989d907fb0ad9e404c2d26101ba5adb24f02308 | 9,085 | py | Python | storm_optimizer/storm_optimizer.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 23,901 | 2018-10-04T19:48:53.000Z | 2022-03-31T21:27:42.000Z | storm_optimizer/storm_optimizer.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 891 | 2018-11-10T06:16:13.000Z | 2022-03-31T10:42:34.000Z | storm_optimizer/storm_optimizer.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 6,047 | 2018-10-12T06:31:02.000Z | 2022-03-31T13:59:28.000Z | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | 39.159483 | 79 | 0.667694 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | 0 | 0 | 0 | 7,726 | 0 | 0 | 0 | 93 | 90 |
406567a6afd0b6d7aa0146a6b1ebb5faf208542b | 1,619 | py | Python | figures/apps.py | bvenkatr/figures | 8724cfac8d8bd3b60f1394eb5eda2fef282770c0 | [
"MIT"
] | null | null | null | figures/apps.py | bvenkatr/figures | 8724cfac8d8bd3b60f1394eb5eda2fef282770c0 | [
"MIT"
] | null | null | null | figures/apps.py | bvenkatr/figures | 8724cfac8d8bd3b60f1394eb5eda2fef282770c0 | [
"MIT"
] | null | null | null | """
Provides application configuration for Figures.
As well as default values for running Figures along with functions to
add entries to the Django conf settings needed to run Figures.
"""
try:
from openedx.core.djangoapps.plugins.constants import (SettingsType)
PLATFORM_PLUGIN_SUPPORT = True
except ImportErr... | 26.983333 | 86 | 0.596665 | """
Provides application configuration for Figures.
As well as default values for running Figures along with functions to
add entries to the Django conf settings needed to run Figures.
"""
from django.apps import AppConfig
try:
from openedx.core.djangoapps.plugins.constants import (
ProjectType, Settings... | 0 | 0 | 0 | 663 | 0 | 0 | 0 | 67 | 46 |
b0fb038ca16eec236e6568df954a1a48cbb60bfe | 6,504 | py | Python | WWTManager.py | FWMSH/WWTManager | 919440492f7fd9a5209ee7fafe4c04f2010d1745 | [
"MIT"
] | null | null | null | WWTManager.py | FWMSH/WWTManager | 919440492f7fd9a5209ee7fafe4c04f2010d1745 | [
"MIT"
] | null | null | null | WWTManager.py | FWMSH/WWTManager | 919440492f7fd9a5209ee7fafe4c04f2010d1745 | [
"MIT"
] | null | null | null | import requests
import sched
import configparser
parser = configparser.ConfigParser()
#parser.read('C:\\Users\\user\\Desktop\\config.INI')
parser.read('C:\\Users\\Morgan.Rehnberg\\Desktop\\config.INI')
config = parser['Config']
name = config['name']
ip = 'localhost'
prefix = "http://"
postfix = ":5050/layerApi.aspx?c... | 29.429864 | 123 | 0.617774 | import requests
import subprocess
import time
import sched
import xml.etree.ElementTree as xmlET
import configparser
from pyautogui import press
parser = configparser.ConfigParser()
#parser.read('C:\\Users\\user\\Desktop\\config.INI')
parser.read('C:\\Users\\Morgan.Rehnberg\\Desktop\\config.INI')
config = parser['Conf... | 0 | 0 | 0 | 0 | 0 | 5,069 | 0 | 8 | 307 |
b6607d633cee9ef82cbd1e8478f6981a9e97f3e2 | 677 | py | Python | src/reduce_squared_matrix.py | mgalardini/2018_ecoli_pathogenicity | f6bfec0fa91bdbea00f55184aa231c56a94daacb | [
"Apache-2.0"
] | 2 | 2018-05-01T14:59:13.000Z | 2019-07-23T18:16:31.000Z | src/reduce_squared_matrix.py | mgalardini/2018_ecoli_pathogenicity | f6bfec0fa91bdbea00f55184aa231c56a94daacb | [
"Apache-2.0"
] | null | null | null | src/reduce_squared_matrix.py | mgalardini/2018_ecoli_pathogenicity | f6bfec0fa91bdbea00f55184aa231c56a94daacb | [
"Apache-2.0"
] | 1 | 2021-09-21T14:47:18.000Z | 2021-09-21T14:47:18.000Z | #!/usr/bin/env python
import sys
import pandas as pd
if __name__ == "__main__":
options = get_options()
m = pd.read_csv(options.df, sep='\t', index_col=0)
s = pd.read_csv(options.matrix, sep='\t', index_col=0)
idx = s.index.intersection(m.index)
s.loc[idx, idx].to_csv(sys.stdout, sep='\t')
| 24.178571 | 65 | 0.645495 | #!/usr/bin/env python
import sys
import argparse
import pandas as pd
def get_options():
description = 'Reduce squared matrix using another dataframe'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('df',
help='Samples dataframe')
parser.add_argu... | 0 | 0 | 0 | 0 | 0 | 321 | 0 | -6 | 45 |
b5c73c48c92da0c223bf6e12ce5c5dab0f39a836 | 4,137 | py | Python | HeatMap.py | robertklee/SENG474-DataMining | 1996e263fb9a84d62ceab2b2402cbbcaf7a1e2d7 | [
"MIT"
] | 14 | 2021-03-09T06:38:39.000Z | 2022-03-11T16:21:46.000Z | HeatMap.py | axjing/PoseEstimate | 85b6ff300e18320fe8b40c89d5f22fde51ba588e | [
"MIT"
] | 23 | 2021-03-07T20:50:50.000Z | 2022-01-17T04:01:08.000Z | HeatMap.py | axjing/PoseEstimate | 85b6ff300e18320fe8b40c89d5f22fde51ba588e | [
"MIT"
] | 9 | 2021-04-13T16:21:44.000Z | 2022-02-23T06:08:30.000Z | import scipy.ndimage as ndimage
| 35.663793 | 133 | 0.591733 | import io
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage as ndimage
from PIL import Image
class HeatMap:
def __init__(self,image,heat_map,gaussian_std=10):
#if image is numpy array
if isinstance(image,np.ndarray):
height = image.sha... | 0 | 0 | 0 | 3,969 | 0 | 0 | 0 | -21 | 156 |
7c1adb7539cebd31cecc2d4235bba82164f11409 | 667 | py | Python | scripts/maintenance/se/simpleslugger.py | OpendataCH/publicbodies | f0c825df05e3c9d0edddabd14ecd993dafa01983 | [
"MIT"
] | 32 | 2015-02-04T14:41:16.000Z | 2022-03-31T15:34:11.000Z | scripts/maintenance/se/simpleslugger.py | OpendataCH/publicbodies | f0c825df05e3c9d0edddabd14ecd993dafa01983 | [
"MIT"
] | 67 | 2015-01-06T18:09:46.000Z | 2022-03-29T13:28:23.000Z | scripts/maintenance/se/simpleslugger.py | OpendataCH/publicbodies | f0c825df05e3c9d0edddabd14ecd993dafa01983 | [
"MIT"
] | 18 | 2015-09-12T17:29:18.000Z | 2021-11-04T13:05:13.000Z | # -*- coding: utf-8 -*-
from nltk.corpus import stopwords as _stopwords
from curses.ascii import isascii
import unicodedata
language = "swedish"
stopwords = list(_stopwords.words(language))
punctuation = u'!(),-.:;?'
make_ascii = lambda text: \
filter(isascii, unicodedata.normalize('NFD', text).encode('utf-8'))
| 30.318182 | 108 | 0.658171 | # -*- coding: utf-8 -*-
from nltk.corpus import stopwords as _stopwords
from curses.ascii import isascii
import unicodedata
language = "swedish"
stopwords = list(_stopwords.words(language))
punctuation = u'!(),-.:;?'
make_ascii = lambda text: \
filter(isascii, unicodedata.normalize('NFD', text).encode('utf-8'))
... | 0 | 0 | 0 | 0 | 0 | 302 | 0 | 0 | 46 |
104a7d4b08a1d0978c53e3b11e9f6682cd8f95e5 | 3,806 | py | Python | backend/twipcrawler.py | cloudhs7/team-project-team4 | c9f784209636b52c4373c38a121d10688d8a6cae | [
"MIT"
] | 4 | 2019-05-02T07:40:24.000Z | 2019-05-22T01:16:58.000Z | backend/twipcrawler.py | cloudhs7/team-project-team4 | c9f784209636b52c4373c38a121d10688d8a6cae | [
"MIT"
] | 9 | 2019-05-29T12:35:09.000Z | 2019-06-22T07:30:08.000Z | backend/twipcrawler.py | cloudhs7/team-project-team4 | c9f784209636b52c4373c38a121d10688d8a6cae | [
"MIT"
] | 7 | 2019-05-12T12:45:14.000Z | 2019-06-21T17:09:48.000Z | from selenium import webdriver
from time import sleep
import json
from pyvirtualdisplay import Display
#-*- coding:utf-8 -*-
#normal way
#login
#facebook way
#first facebook login
delay = 1
#1 : twitch login , #2 : facebook login can get parameter
login_way = 2
display = Display(visible=0, size=(800, 800))
disp... | 32.810345 | 131 | 0.671571 | from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSo... | 0 | 0 | 0 | 0 | 0 | 1,466 | 0 | 160 | 176 |
8f833765d9caedf3232ffc63110ef1e509ea0f3f | 3,227 | py | Python | multifield_batch_update/db/change_log.py | matthayes/anki_multifield_batch_update | 4960a6e969256ff0df2ebf37312e80fa009fcddb | [
"Apache-2.0"
] | 4 | 2019-07-16T21:09:45.000Z | 2021-11-27T12:13:44.000Z | multifield_batch_update/db/change_log.py | matthayes/anki_multifield_batch_update | 4960a6e969256ff0df2ebf37312e80fa009fcddb | [
"Apache-2.0"
] | null | null | null | multifield_batch_update/db/change_log.py | matthayes/anki_multifield_batch_update | 4960a6e969256ff0df2ebf37312e80fa009fcddb | [
"Apache-2.0"
] | 1 | 2020-07-05T23:55:24.000Z | 2020-07-05T23:55:24.000Z | # Copyright 2019 Matthew Hayes
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | 34.329787 | 86 | 0.574837 | # Copyright 2019 Matthew Hayes
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | 0 | 0 | 0 | 2,476 | 0 | 0 | 0 | -11 | 69 |
43aacf6bcd034afc60084586c76aefc9844dab92 | 4,942 | py | Python | genQues/APIv1/getRanking.py | aotella/calcoff_backend | 7f25ff494ea2e1e4119fe7450d805c986fa77f0c | [
"Apache-2.0",
"MIT"
] | null | null | null | genQues/APIv1/getRanking.py | aotella/calcoff_backend | 7f25ff494ea2e1e4119fe7450d805c986fa77f0c | [
"Apache-2.0",
"MIT"
] | null | null | null | genQues/APIv1/getRanking.py | aotella/calcoff_backend | 7f25ff494ea2e1e4119fe7450d805c986fa77f0c | [
"Apache-2.0",
"MIT"
] | null | null | null | #
| 46.186916 | 136 | 0.527317 | from ..models import *
from login.models import *
#
def rankingFunction(data):
try:
rankingObj = rankingSet.objects.filter(questionID=data['questionID'])
sendData = []
userList = []
rank = 0
for i in rankingObj:
rank = rank+1
sendData.append({"userName... | 0 | 0 | 0 | 0 | 0 | 4,840 | 0 | 6 | 89 |
ffad203edf2deb99e9254250c1720f11ed1f3478 | 33 | py | Python | config.py | codexgigassys/neokanji | d58da181ff0220f5e676e66db3a384c3419a99e7 | [
"MIT"
] | 8 | 2017-10-31T18:11:19.000Z | 2020-12-05T02:54:14.000Z | config.py | codexgigassys/neokanji | d58da181ff0220f5e676e66db3a384c3419a99e7 | [
"MIT"
] | null | null | null | config.py | codexgigassys/neokanji | d58da181ff0220f5e676e66db3a384c3419a99e7 | [
"MIT"
] | 3 | 2017-10-13T14:36:34.000Z | 2020-12-05T02:54:25.000Z | user = ""
password = ""
port = "" | 11 | 13 | 0.484848 | user = ""
password = ""
port = "" | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4087c71c1237c3dbe539237d251d91b04f2c594d | 9,609 | py | Python | engine/visualize_infer.py | neolixcn/MonoFlex | 1c4c2f02e0739fd1e34ef68737a4a6d04a0a8559 | [
"MIT"
] | null | null | null | engine/visualize_infer.py | neolixcn/MonoFlex | 1c4c2f02e0739fd1e34ef68737a4a6d04a0a8559 | [
"MIT"
] | null | null | null | engine/visualize_infer.py | neolixcn/MonoFlex | 1c4c2f02e0739fd1e34ef68737a4a6d04a0a8559 | [
"MIT"
] | 1 | 2021-10-20T02:02:02.000Z | 2021-10-20T02:02:02.000Z | import cv2
cv2.setNumThreads(0)
keypoint_colors = [[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156],
[190, 153, 153], [153, 153, 153], [250, 170, 30], [220, 220, 0],
[107, 142, 35], [255, 0, 0], [0, 0, 142], [0, 0, 70],
[152, 251, 152], [0, 130, 180], [220, 20, 60], [0, 60, 100]]
# visuali... | 36.957692 | 129 | 0.676241 | import numpy as np
import matplotlib.pyplot as plt
import torch
import cv2
cv2.setNumThreads(0)
import os
import pdb
from PIL import Image
from scipy.optimize import minimize
from config import TYPE_ID_CONVERSION
from shapely.geometry import Polygon
from config import cfg
from utils.visualizer import Visualizer
from ... | 0 | 0 | 0 | 0 | 0 | 8,736 | 0 | 130 | 379 |
ac6573d639886432ae77e1850cf4995b5a652159 | 1,357 | py | Python | src/sentry/api/endpoints/organization_integration_repos.py | sigismund/sentry | 421a512cd3b4a4c9ed660af536dc5bc4c12a287c | [
"BSD-3-Clause"
] | 1 | 2019-05-28T06:18:03.000Z | 2019-05-28T06:18:03.000Z | src/sentry/api/endpoints/organization_integration_repos.py | sigismund/sentry | 421a512cd3b4a4c9ed660af536dc5bc4c12a287c | [
"BSD-3-Clause"
] | 6 | 2018-10-19T10:04:23.000Z | 2019-12-09T20:29:12.000Z | src/sentry/api/endpoints/organization_integration_repos.py | sigismund/sentry | 421a512cd3b4a4c9ed660af536dc5bc4c12a287c | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
| 34.794872 | 96 | 0.713338 | from __future__ import absolute_import
from django.http import Http404
from sentry.constants import ObjectStatus
from sentry.api.bases.organization import (
OrganizationEndpoint, OrganizationIntegrationsPermission
)
from sentry.integrations.exceptions import IntegrationError
from sentry.integrations.repositories ... | 0 | 0 | 0 | 952 | 0 | 0 | 0 | 208 | 157 |
f45f6851322398a0e3171e53f140b7a4fe76e7c5 | 171 | py | Python | launchable/test_runners/rspec.py | Songmu/cli | f4814e30cedad3feb5e46fd4617238a44717d4bb | [
"Apache-2.0"
] | null | null | null | launchable/test_runners/rspec.py | Songmu/cli | f4814e30cedad3feb5e46fd4617238a44717d4bb | [
"Apache-2.0"
] | null | null | null | launchable/test_runners/rspec.py | Songmu/cli | f4814e30cedad3feb5e46fd4617238a44717d4bb | [
"Apache-2.0"
] | null | null | null | from . import launchable
subset = launchable.CommonSubsetImpls(__name__).scan_files('*_spec.rb')
record_tests = launchable.CommonRecordTestImpls(__name__).report_files()
| 34.2 | 72 | 0.824561 | from . import launchable
subset = launchable.CommonSubsetImpls(__name__).scan_files('*_spec.rb')
record_tests = launchable.CommonRecordTestImpls(__name__).report_files()
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
8e9b1402c70366352db03068fabcd05ac6be740a | 151 | py | Python | spidey_simulation/spidey_py/spidey_python/omniverse/robot/spidey/__init__.py | JasonJZLiu/Spidey-Quadruped | 74c1817f997b354bae4fffd2728f2cc94947062c | [
"MIT"
] | 5 | 2021-06-14T03:12:18.000Z | 2021-12-23T12:58:56.000Z | spidey_simulation/spidey_py/spidey_python/omniverse/robot/spidey/__init__.py | JasonJZLiu/Spidey-Quadruped | 74c1817f997b354bae4fffd2728f2cc94947062c | [
"MIT"
] | null | null | null | spidey_simulation/spidey_py/spidey_python/omniverse/robot/spidey/__init__.py | JasonJZLiu/Spidey-Quadruped | 74c1817f997b354bae4fffd2728f2cc94947062c | [
"MIT"
] | null | null | null | """
This module defines classes for various parts of the franka-allegro robot.
"""
# EOF
| 15.1 | 74 | 0.754967 | """
This module defines classes for various parts of the franka-allegro robot.
"""
from .types import SpideyDim
from .spidey import SpideyBot
# EOF
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 45 |
8301dbe90a3fbe39dec3014f801bd24d3949516e | 516 | py | Python | examples/arduino/basic.py | kimsooyoung/rtcbot | 4f495fbc2189da04701641e0301c684e9dd74f91 | [
"MIT"
] | 35 | 2019-09-19T16:27:21.000Z | 2022-03-23T10:10:08.000Z | examples/arduino/basic.py | kimsooyoung/rtcbot | 4f495fbc2189da04701641e0301c684e9dd74f91 | [
"MIT"
] | 25 | 2019-08-15T07:30:29.000Z | 2021-12-09T22:49:40.000Z | examples/arduino/basic.py | kimsooyoung/rtcbot | 4f495fbc2189da04701641e0301c684e9dd74f91 | [
"MIT"
] | 20 | 2019-03-10T22:39:07.000Z | 2022-03-15T12:24:28.000Z | import asyncio
from rtcbot import SerialConnection
import logging
logging.basicConfig(level=logging.DEBUG)
loop = asyncio.get_event_loop()
conn = SerialConnection("/dev/ttyACM0", startByte=bytes([192, 105]))
asyncio.ensure_future(sendAndReceive(conn))
loop.run_forever()
| 17.793103 | 68 | 0.705426 | import asyncio
from rtcbot import SerialConnection
import logging
logging.basicConfig(level=logging.DEBUG)
async def sendAndReceive(conn):
conn.put_nowait("Hello world!")
while True:
msg = (await conn.get()).decode("ascii")
print(msg)
await asyncio.sleep(1)
loop = asyncio.get_event... | 0 | 29 | 161 | 0 | 0 | 0 | 0 | 0 | 46 |
ea9a2cf279b24b7f2b4b8f7b1f05805e07be312c | 3,781 | py | Python | weather.py | JJBarata/weatherpy | d2ef33436fb19566863cba9dc4ce24ac4d33c8f1 | [
"MIT"
] | null | null | null | weather.py | JJBarata/weatherpy | d2ef33436fb19566863cba9dc4ce24ac4d33c8f1 | [
"MIT"
] | null | null | null | weather.py | JJBarata/weatherpy | d2ef33436fb19566863cba9dc4ce24ac4d33c8f1 | [
"MIT"
] | null | null | null |
BASE_WEATHER_API_URL = 'http://api.openweathermap.org/data/2.5/weather'
# Weather Condition Codes
THUNDERSTORM = range(200, 300)
DRIZZLE = range(300, 400)
RAIN = range(500, 600)
SNOW = range(600, 700)
ATMOSPHERE = range(700, 800)
CLEAR = range(800, 801)
CLOUDY = range(801, 900)
OVERCAST_CLOUDS = range(801, 900)
# Se... | 31.247934 | 89 | 0.66649 | from configparser import ConfigParser
import argparse
import json
import sys
from urllib import parse, request, error
from pprint import pp
import style
BASE_WEATHER_API_URL = 'http://api.openweathermap.org/data/2.5/weather'
# Weather Condition Codes
THUNDERSTORM = range(200, 300)
DRIZZLE = range(300, 400)
RAIN = ra... | 40 | 0 | 0 | 0 | 0 | 2,659 | 0 | -1 | 288 |
65142e09165494e91275464804b35ceef0ddc32b | 84 | py | Python | abc/abc152/abc152a.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | 1 | 2019-08-21T00:49:34.000Z | 2019-08-21T00:49:34.000Z | abc/abc152/abc152a.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | abc/abc152/abc152a.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | N, M = map(int, input().split())
if N == M:
print('Yes')
else:
print('No')
| 12 | 32 | 0.488095 | N, M = map(int, input().split())
if N == M:
print('Yes')
else:
print('No')
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1d0037311a2f57c0438c0a9399c484fb5f3b63b9 | 1,246 | py | Python | utils/logutil.py | SpatialPerceptionNeuralNetwork/SOA_DORN_TF | 33814467e9135036abf28f2da19c5984c8744089 | [
"Unlicense"
] | 17 | 2019-02-17T07:39:39.000Z | 2021-08-17T05:20:19.000Z | utils/logutil.py | SpatialPerceptionNeuralNetwork/SOA_DORN_TF | 33814467e9135036abf28f2da19c5984c8744089 | [
"Unlicense"
] | 6 | 2019-03-04T14:17:22.000Z | 2019-11-07T15:06:55.000Z | utils/logutil.py | SpatialPerceptionNeuralNetwork/SOA_DORN_TF | 33814467e9135036abf28f2da19c5984c8744089 | [
"Unlicense"
] | 4 | 2019-02-17T07:39:47.000Z | 2019-08-13T17:13:23.000Z | import tensorflow as _tf
import logging
_logger = None
_FLAGS = _tf.app.flags.FLAGS
| 28.976744 | 102 | 0.691814 | import os as _os
import tensorflow as _tf
from time import gmtime, strftime
import logging
import logging.handlers
_logger = None
_FLAGS = _tf.app.flags.FLAGS
def _generate_logger():
# log_format = "%(asctime)s [%(levelname)s]: %(filename)s(%(funcName)s:%(lineno)s) >> %(message)s"
log_format = "%(asctime)s [... | 0 | 0 | 0 | 0 | 0 | 1,038 | 0 | 9 | 112 |
fb2a2f55fc4b8520d4d1d757c3e950ea21fafe19 | 6,597 | py | Python | compute_strength.py | CLArg-group/Aspect-Item-Recommender-Systems | 6fe98657cb17bcb8f4eb4606bdea7446909f4a71 | [
"Apache-2.0"
] | 1 | 2021-02-09T21:40:08.000Z | 2021-02-09T21:40:08.000Z | compute_strength.py | CLArg-group/Aspect-Item-Recommender-Systems | 6fe98657cb17bcb8f4eb4606bdea7446909f4a71 | [
"Apache-2.0"
] | null | null | null | compute_strength.py | CLArg-group/Aspect-Item-Recommender-Systems | 6fe98657cb17bcb8f4eb4606bdea7446909f4a71 | [
"Apache-2.0"
] | 1 | 2021-02-09T21:40:55.000Z | 2021-02-09T21:40:55.000Z | ''' calculate film strength'''
| 39.267857 | 151 | 0.674397 | ''' calculate film strength'''
import operator
def film_strength(MUR, MUG, MUA, MUD, user_id, film_id, films, ratings, similarities_for_user, movies_genres, movies_directors, movies_actors):
nSimUsers = 20 # number of similar users to use
simsSorted = sorted(similarities_for_user, key = operator.itemgetter(1), re... | 0 | 0 | 0 | 0 | 0 | 6,501 | 0 | -6 | 69 |
93fdb1e914f110f361666725352474d6a596ffc7 | 8,771 | py | Python | training/utils.py | NeoBoy/tarteel-ml | c85a7f116335dd3f1386904f74f395caef98d402 | [
"MIT"
] | 94 | 2019-11-04T22:15:32.000Z | 2022-03-17T15:40:13.000Z | training/utils.py | NeoBoy/tarteel-ml | c85a7f116335dd3f1386904f74f395caef98d402 | [
"MIT"
] | 28 | 2018-12-31T23:34:01.000Z | 2019-09-07T17:15:57.000Z | training/utils.py | NeoBoy/tarteel-ml | c85a7f116335dd3f1386904f74f395caef98d402 | [
"MIT"
] | 28 | 2019-12-25T01:00:41.000Z | 2022-03-28T14:35:17.000Z | """
Contains helper methods that are used to train and infer Tarteel ML models
"""
import dill as pickle
import numpy as np
import os
def convert_list_of_arrays_to_padded_array(list_varying_sizes, pad_value=0):
"""
Converts a list of 2D arrays of varying sizes to a single 3D numpy array. The extra elements ar... | 44.75 | 120 | 0.695588 | """
Contains helper methods that are used to train and infer Tarteel ML models
"""
import dill as pickle
import numpy as np
import os
def convert_list_of_arrays_to_padded_array(list_varying_sizes, pad_value=0):
"""
Converts a list of 2D arrays of varying sizes to a single 3D numpy array. The extra elements ar... | 0 | 0 | 0 | 0 | 0 | 1,598 | 0 | 0 | 27 |
5c11437158cb3b93c0fcc3b86da00612f99c2f96 | 3,871 | py | Python | gempa/tasks.py | ekaputra07/gempa-monitor | 445684efaaabacd021f256be629308caa3e91187 | [
"MIT"
] | 5 | 2015-01-19T07:35:36.000Z | 2019-12-19T03:28:37.000Z | gempa/tasks.py | ekaputra07/gempa-monitor | 445684efaaabacd021f256be629308caa3e91187 | [
"MIT"
] | 2 | 2015-01-19T06:57:57.000Z | 2016-05-11T11:29:33.000Z | gempa/tasks.py | ekaputra07/gempa-monitor | 445684efaaabacd021f256be629308caa3e91187 | [
"MIT"
] | 1 | 2021-01-10T03:16:40.000Z | 2021-01-10T03:16:40.000Z | import csv
import urllib2
import re
from datetime import datetime, timedelta
from django.conf import settings
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from bs4 import BeautifulSoup
from gempa.models import Gempa, Event
def str_to_datetime(datetime_str):
"""
Conve... | 28.255474 | 88 | 0.576337 | import csv
import urllib2
import re
from datetime import datetime, timedelta
from django.conf import settings
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from bs4 import BeautifulSoup
from gempa.models import Gempa, Event
def str_to_datetime(datetime_str):
"""
Conve... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
f8ce741714c0df21bc55b6862fef9c269cdd67f7 | 557 | py | Python | setup.py | bcb/mpup | fc672aea978a5ee67a515f95efae479dc94677b6 | [
"MIT"
] | 1 | 2019-02-26T20:53:49.000Z | 2019-02-26T20:53:49.000Z | setup.py | bcb/mpup | fc672aea978a5ee67a515f95efae479dc94677b6 | [
"MIT"
] | 3 | 2016-09-06T03:48:11.000Z | 2016-09-06T03:48:49.000Z | setup.py | bcb/mpup | fc672aea978a5ee67a515f95efae479dc94677b6 | [
"MIT"
] | 3 | 2017-05-04T08:01:28.000Z | 2020-01-17T00:42:54.000Z | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='mipy',
version='0.0.1',
description='Copy files to Micropython',
long_description=readme,
author='Beau Barker',
author_email... | 22.28 | 50 | 0.631957 | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='mipy',
version='0.0.1',
description='Copy files to Micropython',
long_description=readme,
author='Beau Barker',
author_email... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
61299b380b2f6fd4b8cef0606ac3e684510311c0 | 718 | py | Python | python/max_profit.py | mohamedabdelbary/algo-exercises | 3b2b700453c010f61c0d4099762727e988e2b124 | [
"MIT"
] | null | null | null | python/max_profit.py | mohamedabdelbary/algo-exercises | 3b2b700453c010f61c0d4099762727e988e2b124 | [
"MIT"
] | null | null | null | python/max_profit.py | mohamedabdelbary/algo-exercises | 3b2b700453c010f61c0d4099762727e988e2b124 | [
"MIT"
] | null | null | null | def max_profit(a):
"""
write a function that takes a list of prices a and returns the max profit possible by buying at a given
price then selling at a future price, for e.g.
[2, 5, 1, 3, 10] should return 9 (10 - 1)
[4, 3, 2, 1] should return 0 (prices are always decreasing)
"""
if len(a) =... | 28.72 | 107 | 0.584958 | def max_profit(a):
"""
write a function that takes a list of prices a and returns the max profit possible by buying at a given
price then selling at a future price, for e.g.
[2, 5, 1, 3, 10] should return 9 (10 - 1)
[4, 3, 2, 1] should return 0 (prices are always decreasing)
"""
if len(a) =... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
02cd3536a1a80b18c932d57a0b353e13d26fb1a3 | 2,017 | py | Python | advanced/mathematical_optimization/examples/plot_compare_optimizers.py | tbarron/scipy-lecture-notes | 4b4e56492ab6bd37d3f8a78f406f255db69428db | [
"CC-BY-4.0"
] | 1 | 2020-02-20T17:36:14.000Z | 2020-02-20T17:36:14.000Z | advanced/mathematical_optimization/examples/plot_compare_optimizers.py | helixcn/scipy-lecture-notes | 4b4e56492ab6bd37d3f8a78f406f255db69428db | [
"CC-BY-4.0"
] | null | null | null | advanced/mathematical_optimization/examples/plot_compare_optimizers.py | helixcn/scipy-lecture-notes | 4b4e56492ab6bd37d3f8a78f406f255db69428db | [
"CC-BY-4.0"
] | null | null | null | """
Plotting the comparison of optimizers
======================================
Plots the results from the comparison of optimizers.
"""
import pickle
import sys
import numpy as np
import matplotlib.pyplot as plt
results = pickle.load(open(
'helper/compare_optimizers_py%s.pkl' % sys.version_info[0],
'rb')... | 28.814286 | 76 | 0.637581 | """
Plotting the comparison of optimizers
======================================
Plots the results from the comparison of optimizers.
"""
import pickle
import sys
import numpy as np
import matplotlib.pyplot as plt
results = pickle.load(open(
'helper/compare_optimizers_py%s.pkl' % sys.version_info[0],
'rb')... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
7313c6ae4a2ff76225a6986a466ad3a81fd91c04 | 1,367 | py | Python | data/external/repositories/282756/dsb_caffe-master/scripts/crps.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories/282756/dsb_caffe-master/scripts/crps.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories/282756/dsb_caffe-master/scripts/crps.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | 1 | 2019-12-04T08:23:33.000Z | 2019-12-04T08:23:33.000Z | from IPython.utils import io
import numpy as np
import sys
import math
import re
import csv
distFile = sys.argv[1]
gtFile = sys.argv[2]
dataV = np.transpose(np.loadtxt(gtFile, delimiter=",",skiprows=1)).astype('float')
ids, t_esv, t_edv= dataV
smallest_id=100000
with open(distFile, 'r') as csvfile:
distsCV=csv.re... | 21.698413 | 82 | 0.621068 | from IPython.utils import io
import numpy as np
import sys
import math
import re
import csv
distFile = sys.argv[1]
gtFile = sys.argv[2]
dataV = np.transpose(np.loadtxt(gtFile, delimiter=",",skiprows=1)).astype('float')
ids, t_esv, t_edv= dataV
smallest_id=100000
with open(distFile, 'r') as csvfile:
distsCV=csv.re... | 0 | 0 | 0 | 0 | 0 | 250 | 0 | 0 | 23 |
76b49df3cae6a662dff58a9fd76903dda7db1adf | 1,070 | py | Python | address/migrations/0001_initial.py | dasundev/django-ecommerce-project | e6187e3f70f0e1f7b4cc0003b03696b4088534f8 | [
"Apache-2.0"
] | null | null | null | address/migrations/0001_initial.py | dasundev/django-ecommerce-project | e6187e3f70f0e1f7b4cc0003b03696b4088534f8 | [
"Apache-2.0"
] | null | null | null | address/migrations/0001_initial.py | dasundev/django-ecommerce-project | e6187e3f70f0e1f7b4cc0003b03696b4088534f8 | [
"Apache-2.0"
] | 1 | 2021-10-03T05:45:55.000Z | 2021-10-03T05:45:55.000Z | # Generated by Django 2.2.12 on 2020-05-13 07:43
| 36.896552 | 127 | 0.585047 | # Generated by Django 2.2.12 on 2020-05-13 07:43
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Address',
fields=[
('id', models.AutoField... | 0 | 0 | 0 | 955 | 0 | 0 | 0 | 19 | 46 |
14bfd0b77bba883d5299d1126f50c21ac4c8efb9 | 2,930 | py | Python | src/main.py | yosipy/asagao-minecraft | 56ac05e2539e15faed11c994af4ff2c5f81f6bb1 | [
"MIT"
] | null | null | null | src/main.py | yosipy/asagao-minecraft | 56ac05e2539e15faed11c994af4ff2c5f81f6bb1 | [
"MIT"
] | 15 | 2021-03-08T18:59:16.000Z | 2021-03-21T18:24:05.000Z | src/main.py | yosipy/asagao-minecraft | 56ac05e2539e15faed11c994af4ff2c5f81f6bb1 | [
"MIT"
] | 3 | 2021-03-08T03:37:52.000Z | 2021-07-14T22:08:12.000Z | # python3 -m pip install -U discord.py
# pip install requests
import sys
import time
import discord
from discord.ext import tasks
import requests
import json
import conoha_wrap
import conoha_main
import conoha_sub
import utility
import datetime
client = discord.Client()
client.isProcessing = False
client.channel = N... | 29.3 | 125 | 0.750512 | # python3 -m pip install -U discord.py
# pip install requests
import sys
import time
import discord
from discord.ext import tasks
import requests
import json
import conoha_wrap
import conoha_main
import conoha_sub
import utility
import datetime
from config import *
client = discord.Client()
client.isProcessing = Fal... | 60 | 1,783 | 570 | 0 | 0 | 0 | 0 | -1 | 136 |
4eccd534e55b2de919a661a0749c96ece4331251 | 9,527 | py | Python | deep_rf/deep_rf_learner.py | solstat/snake_learning | 5d8403f2f72751ca1fcbfffb248300d104fcfce3 | [
"BSD-3-Clause"
] | null | null | null | deep_rf/deep_rf_learner.py | solstat/snake_learning | 5d8403f2f72751ca1fcbfffb248300d104fcfce3 | [
"BSD-3-Clause"
] | null | null | null | deep_rf/deep_rf_learner.py | solstat/snake_learning | 5d8403f2f72751ca1fcbfffb248300d104fcfce3 | [
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python
"""
Does Deep Q-Learning for Snake
"""
# Import Modules
| 36.783784 | 103 | 0.602498 |
#!/usr/bin/env python
"""
Does Deep Q-Learning for Snake
"""
# Import Modules
import numpy as np
import tensorflow as tf
import os
from single_player_game import SinglePlayerGame
from q_graph import QGraph
import epsilon_method
class ExperienceTuple:
""" ExperienceTuple data structure for DeepRFLearner """
... | 0 | 0 | 0 | 9,226 | 0 | 0 | 0 | 18 | 201 |
3d94fa901580f8ff540a47c643a62d697871b8ac | 270 | py | Python | language_features/exception/dict_keyerror_exception.py | PrasadHonrao/python-samples | faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a | [
"MIT"
] | 3 | 2018-08-20T13:00:01.000Z | 2021-09-18T04:19:46.000Z | language_features/exception/dict_keyerror_exception.py | PrasadHonrao/python-samples | faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a | [
"MIT"
] | 1 | 2021-06-25T20:25:02.000Z | 2021-08-19T22:44:31.000Z | language_features/exception/dict_keyerror_exception.py | PrasadHonrao/python-samples | faa48aa3eaf2d67b8cef0114e1f6ef08e2c1300a | [
"MIT"
] | 1 | 2021-09-18T23:51:20.000Z | 2021-09-18T23:51:20.000Z | student = {
"firstName": "Prasad",
"lastName": "Honrao",
"age": 37
}
try:
#try to get wrong value from dictionary
last_name = student["last_name"]
except KeyError as error:
print("Exception thrown!")
print(error)
print("Done!") | 19.285714 | 44 | 0.596296 | student = {
"firstName": "Prasad",
"lastName": "Honrao",
"age": 37
}
try:
#try to get wrong value from dictionary
last_name = student["last_name"]
except KeyError as error:
print("Exception thrown!")
print(error)
print("Done!") | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3761572252963ddf49998c7fd0fee2bd1c25e8ed | 2,616 | py | Python | Krakatau-master/Krakatau/disassemble.py | orneryhippo/saturdays | 525ce086452e96a01d1762418c79d4c84fd605b5 | [
"Apache-2.0"
] | null | null | null | Krakatau-master/Krakatau/disassemble.py | orneryhippo/saturdays | 525ce086452e96a01d1762418c79d4c84fd605b5 | [
"Apache-2.0"
] | null | null | null | Krakatau-master/Krakatau/disassemble.py | orneryhippo/saturdays | 525ce086452e96a01d1762418c79d4c84fd605b5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python2
import functools
import os.path
import time, zipfile, sys
import StringIO
import Krakatau
from Krakatau import script_util
from Krakatau.classfileformat.reader import Reader
from Krakatau.classfileformat.classdata import ClassData
from Krakatau.assembler.disassembly import Disassembler
if __nam... | 37.913043 | 126 | 0.675459 | #!/usr/bin/env python2
import functools
import os.path
import time, zipfile, sys
import StringIO
import Krakatau
from Krakatau import script_util
from Krakatau.classfileformat.reader import Reader
from Krakatau.classfileformat.classdata import ClassData
from Krakatau.assembler.disassembly import Disassembler
def read... | 0 | 0 | 0 | 0 | 0 | 1,027 | 0 | 0 | 69 |
8666ed4a13f01918505951a923925ab74a639df8 | 376 | py | Python | main.py | FausticSun/NoveltyDQN | 01eb2fd57d1d27a82d06267ea36c4dc76161b3b9 | [
"MIT"
] | null | null | null | main.py | FausticSun/NoveltyDQN | 01eb2fd57d1d27a82d06267ea36c4dc76161b3b9 | [
"MIT"
] | null | null | null | main.py | FausticSun/NoveltyDQN | 01eb2fd57d1d27a82d06267ea36c4dc76161b3b9 | [
"MIT"
] | 2 | 2019-07-05T03:34:20.000Z | 2020-12-12T07:12:48.000Z | import gym
if __name__ == "__main__":
env = gym.make('BipedalWalkerHardcore-v2')
# get initial obsevation of the environment
observation = env.reset()
while (True):
env.render()
print(observation);
# choose the action to take
action = env.action_space.sample()
... | 20.888889 | 60 | 0.630319 | import gym
if __name__ == "__main__":
env = gym.make('BipedalWalkerHardcore-v2')
# get initial obsevation of the environment
observation = env.reset()
while (True):
env.render()
print(observation);
# choose the action to take
action = env.action_space.sample()
... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
f5426a7d5be55a89bc8adaec9add523a7f25a11e | 459 | py | Python | tests/vmobjects/test_string.py | QDucasse/PySOM | 0b8801838a8902894dd606c0f84f1dcde79061d8 | [
"MIT"
] | 1 | 2020-10-06T13:57:43.000Z | 2020-10-06T13:57:43.000Z | tests/vmobjects/test_string.py | QDucasse/PySOM | 0b8801838a8902894dd606c0f84f1dcde79061d8 | [
"MIT"
] | null | null | null | tests/vmobjects/test_string.py | QDucasse/PySOM | 0b8801838a8902894dd606c0f84f1dcde79061d8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@author: Quentin DUCASSE
"""
| 21.857143 | 67 | 0.686275 | # -*- coding: utf-8 -*-
"""
@author: Quentin DUCASSE
"""
import unittest
from som.vmobjects.object import Object
from som.vmobjects.string import String
class StringTestCase(unittest.TestCase):
def setUp(self):
self.string = String(Object(None), "test")
def test_get_embedded_string(self):
s... | 0 | 0 | 0 | 281 | 0 | 0 | 0 | 30 | 90 |
d356618dbeb929ff0e3dddcf42c9929784b739f5 | 4,593 | py | Python | german_experiment.py | laurensalvarez/Fooling-LIME-SHAP | e7505795b239406e11f838f27b2ca5da09139d6b | [
"MIT"
] | 55 | 2019-11-29T14:43:57.000Z | 2022-03-26T13:57:16.000Z | german_experiment.py | laurensalvarez/Fooling-LIME-SHAP | e7505795b239406e11f838f27b2ca5da09139d6b | [
"MIT"
] | 7 | 2020-04-21T17:53:31.000Z | 2022-03-10T20:42:57.000Z | german_experiment.py | laurensalvarez/Fooling-LIME-SHAP | e7505795b239406e11f838f27b2ca5da09139d6b | [
"MIT"
] | 13 | 2020-02-21T20:11:37.000Z | 2022-02-16T07:39:01.000Z | """
The experiment MAIN for GERMAN.
"""
import warnings
warnings.filterwarnings('ignore')
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np
import lime
import lime.lime_tabular
import shap
from sklearn.cluster import KMeans
# Set up experimen... | 37.647541 | 442 | 0.747442 | """
The experiment MAIN for GERMAN.
"""
import warnings
warnings.filterwarnings('ignore')
from adversarial_models import *
from utils import *
from get_data import *
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np
import pandas as pd
import ... | 0 | 0 | 0 | 590 | 0 | 0 | 0 | 12 | 157 |
afb5477ecd07f2ad55cf64b5cf3600da4e114452 | 493 | py | Python | 2020-03-26-Python-Object-Model/examples/dict-vs-slots.py | s3rvac/talks | 469ea5d2d3d90527f77863b85746bbc2d7236cb1 | [
"BSD-3-Clause"
] | 2 | 2019-05-15T06:42:32.000Z | 2020-08-01T11:48:40.000Z | 2020-03-26-Python-Object-Model/examples/dict-vs-slots.py | s3rvac/talks | 469ea5d2d3d90527f77863b85746bbc2d7236cb1 | [
"BSD-3-Clause"
] | null | null | null | 2020-03-26-Python-Object-Model/examples/dict-vs-slots.py | s3rvac/talks | 469ea5d2d3d90527f77863b85746bbc2d7236cb1 | [
"BSD-3-Clause"
] | 1 | 2017-03-28T21:14:37.000Z | 2017-03-28T21:14:37.000Z | # __dict__ vs __slots__
a = A(1, 2)
assert '__dict__' in dir(a)
# 'b' will have a lower memory footprint (no dict) and provide faster attribute
# access (again, no need to go through a dict when accessing them) than 'a' due
# to the use of __slots__:
b = B(1, 2)
assert '__dict__' not in dir(b)
| 19.72 | 79 | 0.604462 | # __dict__ vs __slots__
import sys
class A:
def __init__(self, x, y):
self.x = x
self.y = y
class B:
__slots__ = ('x', 'y')
def __init__(self, x, y):
self.x = x
self.y = y
a = A(1, 2)
assert '__dict__' in dir(a)
# 'b' will have a lower memory footprint (no dict) and pro... | 0 | 0 | 0 | 138 | 0 | 0 | 0 | -11 | 69 |
1874dd5bb21245b476ba90bfc545f3ffc047af29 | 5,622 | py | Python | tests/test_udp_message.py | pwitab/dlms-cosem | aa9e18e6ef8a4fee30da8b797dad03b0b7847780 | [
"MIT"
] | 35 | 2018-05-24T08:16:35.000Z | 2022-02-24T16:07:07.000Z | tests/test_udp_message.py | Layty/dlms-cosem | 95b67054a1dfb928e960547b0246b7b6794f0594 | [
"MIT"
] | 41 | 2020-12-18T16:31:40.000Z | 2021-12-13T20:59:42.000Z | tests/test_udp_message.py | Layty/dlms-cosem | 95b67054a1dfb928e960547b0246b7b6794f0594 | [
"MIT"
] | 19 | 2019-04-02T14:32:01.000Z | 2021-12-14T13:24:29.000Z |
data_examples_encrypted_data_nofication = [
b"\x00\x01\x00\x01\x00\x01\x00F\xdb\x08/\x19\"\x91\x99\x16A\x03;0\x00\x00\x01\xe5\x02\\\xe9\xd2'\x1f\xd7\x8b\xe8\xc2\x04!\x1a\x91j\x9d\x7fX~\nz\x81L\xad\xea\x89\xe9Y?\x01\xf9.\xa8\xc0\x87\xb5\xbd\xfd\xef\xea\xb6\xbe\xcf(-\xfeI\xc0\x8f[\xe6\xdc\x84\x00",
b'\x00\x01\x0... | 80.314286 | 257 | 0.706866 | import pytest
from dlms_cosem.protocol.wrappers import DlmsUdpMessage, WrapperHeader
data_examples_encrypted_data_nofication = [
b"\x00\x01\x00\x01\x00\x01\x00F\xdb\x08/\x19\"\x91\x99\x16A\x03;0\x00\x00\x01\xe5\x02\\\xe9\xd2'\x1f\xd7\x8b\xe8\xc2\x04!\x1a\x91j\x9d\x7fX~\nz\x81L\xad\xea\x89\xe9Y?\x01\xf9.\xa8\xc0\x... | 0 | 0 | 0 | 0 | 0 | 1,564 | 0 | 41 | 91 |
020a4f18e685df3e5fa88d82431b69c4b7b5e66a | 16,284 | py | Python | clifford/numba/_multivector.py | pygae/clifford | e63f8564d64d6a5dad5fbb415772eb8aecbc2d8f | [
"BSD-3-Clause"
] | 642 | 2017-11-17T09:49:48.000Z | 2022-03-21T22:02:25.000Z | clifford/numba/_multivector.py | pygae/clifford | e63f8564d64d6a5dad5fbb415772eb8aecbc2d8f | [
"BSD-3-Clause"
] | 347 | 2017-11-17T13:57:43.000Z | 2022-01-20T09:40:15.000Z | clifford/numba/_multivector.py | pygae/clifford | e63f8564d64d6a5dad5fbb415772eb8aecbc2d8f | [
"BSD-3-Clause"
] | 61 | 2017-11-19T17:15:26.000Z | 2022-01-15T05:18:27.000Z | """
Numba support for MultiVector objects.
For now, this just supports .value wrapping / unwrapping
"""
import numba
try:
# module locations as of numba 0.49.0
import numba.np.numpy_support as _numpy_support
from numba.core.imputils import impl_ret_borrowed, lower_constant
from numba.core import cguti... | 37.178082 | 112 | 0.682081 | """
Numba support for MultiVector objects.
For now, this just supports .value wrapping / unwrapping
"""
import numba
import operator
import numpy as np
from numba.extending import NativeValue
import llvmlite.ir
try:
# module locations as of numba 0.49.0
import numba.np.numpy_support as _numpy_support
from... | 0 | 13,812 | 0 | 291 | 0 | 0 | 0 | 117 | 946 |
d19f046ebf19852f138a125dbf5c40474c8ce183 | 464 | py | Python | pants_plugins/sendwave/pants_docker/utils.py | waveremit/pants-docker | 9540f10262eab1b3ec2e6862899772cac9902166 | [
"Apache-2.0"
] | 1 | 2021-05-12T03:52:41.000Z | 2021-05-12T03:52:41.000Z | pants_plugins/sendwave/pants_docker/utils.py | waveremit/pants-docker | 9540f10262eab1b3ec2e6862899772cac9902166 | [
"Apache-2.0"
] | 2 | 2021-07-27T17:56:41.000Z | 2022-02-24T20:19:10.000Z | pants_plugins/sendwave/pants_docker/utils.py | waveremit/pants-docker | 9540f10262eab1b3ec2e6862899772cac9902166 | [
"Apache-2.0"
] | 2 | 2021-07-08T21:39:14.000Z | 2022-02-24T17:00:23.000Z | """Plugin-wide utility data."""
# Docker uses all of these env variables to connect to the docker
# server process
DOCKER_ENV_VARS = [
"DOCKER_CERT_PATH",
"DOCKER_CONFIG",
"DOCKER_CONTENT_TRUST_SERVER",
"DOCKER_CONTENT_TRUST",
"DOCKER_CONTEXT",
"DOCKER_DEFAULT_PLATFORM",
"DOCKER_HIDE_LEGACY... | 23.2 | 65 | 0.696121 | """Plugin-wide utility data."""
# Docker uses all of these env variables to connect to the docker
# server process
DOCKER_ENV_VARS = [
"DOCKER_CERT_PATH",
"DOCKER_CONFIG",
"DOCKER_CONTENT_TRUST_SERVER",
"DOCKER_CONTENT_TRUST",
"DOCKER_CONTEXT",
"DOCKER_DEFAULT_PLATFORM",
"DOCKER_HIDE_LEGACY... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2ddca774f658cdae1882d981f1c4876a6b1932f6 | 698 | py | Python | ae_dev.py | varennes/autoencoder-mnist | dd12d79bd823dc98cb965305da6e9ca9a49f38a8 | [
"MIT"
] | null | null | null | ae_dev.py | varennes/autoencoder-mnist | dd12d79bd823dc98cb965305da6e9ca9a49f38a8 | [
"MIT"
] | null | null | null | ae_dev.py | varennes/autoencoder-mnist | dd12d79bd823dc98cb965305da6e9ca9a49f38a8 | [
"MIT"
] | null | null | null | # Autoencoder development
import numpy as np
import matplotlib.pyplot as plt
from ae_module import AE_model
from keras.datasets import mnist
if __name__ == '__main__':
# load and prep MNIST data
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.astype('float32') / 255.
x_test = x_test... | 29.083333 | 72 | 0.680516 | # Autoencoder development
import numpy as np
import matplotlib.pyplot as plt
from ae_module import AE_model
from keras.datasets import mnist
if __name__ == '__main__':
# load and prep MNIST data
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.astype('float32') / 255.
x_test = x_test... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1c108320463f0ca0d24d165864ebd90da29c9fc2 | 2,496 | py | Python | qiskit/aqua/utils/qp_solver.py | georgesbarron/qiskit-aqua | b38ca9893c5f9509693a2de48680781bed300987 | [
"Apache-2.0"
] | 1 | 2019-10-12T16:20:25.000Z | 2019-10-12T16:20:25.000Z | qiskit/aqua/utils/qp_solver.py | georgesbarron/qiskit-aqua | b38ca9893c5f9509693a2de48680781bed300987 | [
"Apache-2.0"
] | null | null | null | qiskit/aqua/utils/qp_solver.py | georgesbarron/qiskit-aqua | b38ca9893c5f9509693a2de48680781bed300987 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 31.2 | 91 | 0.626603 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
a57284baaa4e9bb23c08a86b16c31efd4b0a2c60 | 8,432 | py | Python | draw_q_function3d.py | jaraujo98/SinglePartitionAdaptiveQLearning | 4084a27fdbfcfefd31e9be3f82628bdc50244998 | [
"MIT"
] | 1 | 2020-11-05T02:16:12.000Z | 2020-11-05T02:16:12.000Z | draw_q_function3d.py | jaraujo98/SinglePartitionAdaptiveQLearning | 4084a27fdbfcfefd31e9be3f82628bdc50244998 | [
"MIT"
] | null | null | null | draw_q_function3d.py | jaraujo98/SinglePartitionAdaptiveQLearning | 4084a27fdbfcfefd31e9be3f82628bdc50244998 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 16:38:07 2020
This file includes functions which are helpful to visualize the partitions and
the Q functions for the Oil and Ambulance problems.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def ... | 26.939297 | 80 | 0.594165 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 16:38:07 2020
This file includes functions which are helpful to visualize the partitions and
the Q functions for the Oil and Ambulance problems.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 23 |
1a49e5fe07248f4cdf4ee33ffa8461be58432ceb | 247 | py | Python | bubbleSort.py | Lioncat2002/computerProjPy | accb584443796967a4c3f0e8afce3d39e44cb113 | [
"MIT"
] | null | null | null | bubbleSort.py | Lioncat2002/computerProjPy | accb584443796967a4c3f0e8afce3d39e44cb113 | [
"MIT"
] | null | null | null | bubbleSort.py | Lioncat2002/computerProjPy | accb584443796967a4c3f0e8afce3d39e44cb113 | [
"MIT"
] | null | null | null | '''5.WAP to input a list and arrange the list in ascending order with bubble sort'''
l=eval(input("Enter the list: "))
for j in range(0,len(l)):
for i in range(0,len(l)-1):
if(l[i]>l[i+1]):
l[i+1],l[i]=l[i],l[i+1]
print(l) | 30.875 | 84 | 0.57085 | '''5.WAP to input a list and arrange the list in ascending order with bubble sort'''
l=eval(input("Enter the list: "))
for j in range(0,len(l)):
for i in range(0,len(l)-1):
if(l[i]>l[i+1]):
l[i+1],l[i]=l[i],l[i+1]
print(l) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
e2c7ee10aa531ec65d63ec72ac9930f90f047f89 | 1,543 | py | Python | petri_net_plan/scripts/example.py | cdondrup/petri_net | 2ae725b41b73db5b81611a11a3d10a39fdef3a1b | [
"MIT"
] | 1 | 2019-09-11T10:55:52.000Z | 2019-09-11T10:55:52.000Z | petri_net_plan/scripts/example.py | cdondrup/petri_net | 2ae725b41b73db5b81611a11a3d10a39fdef3a1b | [
"MIT"
] | null | null | null | petri_net_plan/scripts/example.py | cdondrup/petri_net | 2ae725b41b73db5b81611a11a3d10a39fdef3a1b | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
if __name__ == "__main__":
Example()
| 32.145833 | 75 | 0.695399 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from pnp_gen.generator import Generator
from pnp_actions.pn_action import PNAction
from pnp_actions.recovery import Recovery, Before, During, After
from pnp_kb.queries import LocalQuery, RemoteQuery, Query
from pnp_kb.external_knowledge_base import ExternalKnowledgeBase
from p... | 0 | 0 | 0 | 1,024 | 0 | 0 | 0 | 208 | 223 |
7f0bf61de90c6de206d16e3f9b136afbf541717c | 5,520 | py | Python | obsim/models/spectral/data_driven.py | fjfaggingerauer/obsim | a5a9a48841fc13e822fbbfbbd0fb0fd0953cdd5a | [
"MIT"
] | null | null | null | obsim/models/spectral/data_driven.py | fjfaggingerauer/obsim | a5a9a48841fc13e822fbbfbbd0fb0fd0953cdd5a | [
"MIT"
] | null | null | null | obsim/models/spectral/data_driven.py | fjfaggingerauer/obsim | a5a9a48841fc13e822fbbfbbd0fb0fd0953cdd5a | [
"MIT"
] | null | null | null |
__all__ = ['InterpolatedSpectrum', 'FunctionSpectrum', 'BT_SETTLSpectrum',
'PhoenixSpectrum']
| 37.297297 | 139 | 0.648732 | import numpy as np
import astropy.units as u
from astropy import constants as const
from ...util import set_units
from ...config import default_units
from ...field import Field
from ...external import get_PHOENIX_spectrum, get_BT_SETTL_spectrum
from .base import SpectralModel
from .util import make_spectrum_unit_field... | 0 | 742 | 0 | 4,233 | 0 | 0 | 0 | 122 | 314 |
97c1e8efc59482131a7e9838dc27043aedb01374 | 750 | py | Python | lsql/lsql/settings.py | Tamiflu9/lsql | 5e2620eedd32949af85ea885cb54fe0f16defd0d | [
"MIT"
] | 2 | 2020-07-23T18:44:46.000Z | 2021-04-19T07:10:48.000Z | lsql/lsql/settings.py | Tamiflu9/lsql | 5e2620eedd32949af85ea885cb54fe0f16defd0d | [
"MIT"
] | 93 | 2020-09-14T12:35:44.000Z | 2021-12-13T21:08:47.000Z | lsql/lsql/settings.py | Tamiflu9/lsql | 5e2620eedd32949af85ea885cb54fe0f16defd0d | [
"MIT"
] | 18 | 2020-09-24T13:38:28.000Z | 2021-04-19T09:24:19.000Z | """
Django settings for lsql project. Loads settings_shared and settings_dev or settings_deploy
depending on the value of DJANGO_DEVELOPMENT
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of ... | 27.777778 | 91 | 0.777333 | """
Django settings for lsql project. Loads settings_shared and settings_dev or settings_deploy
depending on the value of DJANGO_DEVELOPMENT
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24 | 74 |
cb26a8936a4f9351b6fca2844c6bc7e8134f3b0a | 9,521 | py | Python | introspection/dundermethods.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | 1 | 2022-03-02T23:13:06.000Z | 2022-03-02T23:13:06.000Z | introspection/dundermethods.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | null | null | null | introspection/dundermethods.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | null | null | null |
from typing import Iterable, Dict, Any, Callable, Optional
__all__ = ['DUNDERMETHOD_NAMES', 'AUGMENTED_ASSIGNMENT_DUNDERMETHOD_NAMES',
'iter_class_dundermethods', 'class_implements_dundermethod', 'class_implements_any_dundermethod', 'class_implements_dundermethods', 'collect_class_dundermethods', 'get_clas... | 40.172996 | 1,485 | 0.647726 |
from typing import Iterator, Iterable, Tuple, Dict, Any, Callable, Optional
from .misc import static_vars
__all__ = ['DUNDERMETHOD_NAMES', 'AUGMENTED_ASSIGNMENT_DUNDERMETHOD_NAMES',
'iter_class_dundermethods', 'class_implements_dundermethod', 'class_implements_any_dundermethod', 'class_implements_dunderme... | 0 | 0 | 0 | 0 | 1,488 | 104 | 0 | 25 | 69 |
c86437c317fef3a04fee97738d25e0c4a3be6d96 | 8,912 | py | Python | pytorch/torch_model.py | LianShuaiLong/Codebook | fd67440d2de80b48aa90b9f7ea5d459baee0a6d8 | [
"MIT"
] | null | null | null | pytorch/torch_model.py | LianShuaiLong/Codebook | fd67440d2de80b48aa90b9f7ea5d459baee0a6d8 | [
"MIT"
] | null | null | null | pytorch/torch_model.py | LianShuaiLong/Codebook | fd67440d2de80b48aa90b9f7ea5d459baee0a6d8 | [
"MIT"
] | null | null | null | # copy from https://github.com/LianShuaiLong/CV_Applications/blob/master/classification/classification-pytorch/backbones/vgg19.py
import torch
import torch.nn as nn
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = ConvNet(in_channels=3,num_classes=1000,bn=True).to(device)
# biliear pooling
x = torc... | 37.288703 | 129 | 0.638128 | # copy from https://github.com/LianShuaiLong/CV_Applications/blob/master/classification/classification-pytorch/backbones/vgg19.py
import torch
import torch.nn as nn
class ConvNet(nn.Module):
def __init__(self,in_channels,num_classes,bn=False):
super(ConvNet,self).__init__()#调用父类的初始化函数
self.num_clas... | 1,206 | 0 | 0 | 5,261 | 0 | 0 | 0 | 0 | 45 |
d9c8a034bf4b87c98de88288d545f61c473a3f2d | 17,360 | py | Python | src/Sorption_PB_functions/four_layer_model_LNX_withFixSpeciesOption_Scaling_2surface.py | Whatsoever/SurfComp | 4887162fef765d0c84e2bb72f0c26974aef30aec | [
"MIT"
] | 1 | 2019-05-17T10:46:08.000Z | 2019-05-17T10:46:08.000Z | src/Sorption_PB_functions/four_layer_model_LNX_withFixSpeciesOption_Scaling_2surface.py | Whatsoever/SurfComp | 4887162fef765d0c84e2bb72f0c26974aef30aec | [
"MIT"
] | null | null | null | src/Sorption_PB_functions/four_layer_model_LNX_withFixSpeciesOption_Scaling_2surface.py | Whatsoever/SurfComp | 4887162fef765d0c84e2bb72f0c26974aef30aec | [
"MIT"
] | 1 | 2018-08-02T06:54:38.000Z | 2018-08-02T06:54:38.000Z | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 21:38:42 2019
"""
import numpy as np
from scipy import linalg
# try to keep it in block
##################### basic functions ################################################
def mass_action_law (ln_X, ln_K, A):
'''
all inputs are numpy arrays!!!
... | 49.17847 | 265 | 0.641129 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 21:38:42 2019
"""
import numpy as np
from scipy import linalg
# try to keep it in block
##################### basic functions ################################################
def mass_action_law (ln_X, ln_K, A):
'''
all inputs are numpy arrays!!!
... | 12 | 0 | 0 | 431 | 0 | 7,841 | 0 | 0 | 210 |
1d09e940ea82d2393f7ba152f4bedbce59d28164 | 2,830 | py | Python | examples/hvi2/liveplottest_hvi_queueing_markers.py | peendebak/core_tools | 2e43edf0bbc1d7ceb7042559db499535e8f6a076 | [
"BSD-2-Clause"
] | 1 | 2022-02-11T09:24:35.000Z | 2022-02-11T09:24:35.000Z | examples/hvi2/liveplottest_hvi_queueing_markers.py | peendebak/core_tools | 2e43edf0bbc1d7ceb7042559db499535e8f6a076 | [
"BSD-2-Clause"
] | null | null | null | examples/hvi2/liveplottest_hvi_queueing_markers.py | peendebak/core_tools | 2e43edf0bbc1d7ceb7042559db499535e8f6a076 | [
"BSD-2-Clause"
] | 2 | 2020-07-06T14:31:27.000Z | 2021-07-07T13:57:19.000Z | import logging
import qcodes
import qcodes.logger as logger
from keysight_fpga.sd1.fpga_utils import print_fpga_info
from keysight_fpga.sd1.dig_iq import load_iq_image
from keysight_fpga.qcodes.M3202A_fpga import M3202A_fpga
from core_tools.drivers.M3102A import SD_DIG, MODES
from core_tools.HVI2.hvi2_schedule_load... | 26.203704 | 104 | 0.701413 | import time
import logging
from PyQt5 import QtCore
import qcodes
import qcodes.logger as logger
from qcodes.logger import start_all_logging
from keysight_fpga.sd1.fpga_utils import \
print_fpga_info, config_fpga_debug_log, print_fpga_log
from keysight_fpga.sd1.dig_iq import load_iq_image
from keysight_fpga.qcod... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 66 |
f54b05cc857a074f404c751cd98bf1d6a15de9ed | 1,667 | py | Python | tests/test_revnet.py | tbung/pytorch-revnet | c75f82b03989e9341cc4723954d3dcc567aa461b | [
"MIT"
] | 83 | 2018-02-01T10:16:10.000Z | 2022-03-10T10:08:32.000Z | tests/test_revnet.py | tbung/pytorch-revnet | c75f82b03989e9341cc4723954d3dcc567aa461b | [
"MIT"
] | 7 | 2018-02-14T15:18:18.000Z | 2021-06-10T06:54:02.000Z | tests/test_revnet.py | tbung/revnet | c75f82b03989e9341cc4723954d3dcc567aa461b | [
"MIT"
] | 15 | 2018-02-16T23:04:43.000Z | 2022-02-04T01:09:22.000Z | import torch
import unittest
if __name__ == '__main__':
unittest.main()
| 27.783333 | 65 | 0.60228 | import torch
import torch.autograd
from torch.autograd import Variable
from revnet import RevBlock, RevBlockFunction
import unittest
from .common import TestCase
class TestRevNet(TestCase):
def setUp(self):
self.x = torch.rand(4, 4, 4, 4)
self.model = RevBlock(4, 4, [])
parameters = lis... | 0 | 0 | 0 | 1,429 | 0 | 0 | 0 | 45 | 113 |