index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
56,442 | adrianomiranda14/framework-predictor | refs/heads/main | /helpers.py | import pandas as pd
def lower_case(dataframe):
""" Transforms all values in columns to lower case """
for col in dataframe.columns:
if dataframe[col].dtypes == 'object':
dataframe[col] = dataframe[col].str.lower()
return dataframe
def clean_columns(path):
"This cleans column names of the csv pas... | {"/cleaning.py": ["/helpers.py"], "/main.py": ["/helpers.py"]} |
56,479 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/tests/functional/test_views.py | #coding: utf-8
from django.test import TestCase
from django.contrib.auth.models import User
from ...views import Post, Tag, Base
class BaseTest(TestCase, Base):
@classmethod
def setUpClass(cls):
cls.author1 = User.objects.create(username='Author 1')
cls.author2 = User.objects.create(username=... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,480 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/views.py | # coding: utf-8
from django.views.generic import ListView, DetailView
from django.contrib.auth.models import User
from .models import Post, Tag
class Base:
@property
def tags(self):
return Tag.objects.all()
@property
def authors_with_post(self):
posts = Post.objects.select_related('... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,481 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/urls.py | # coding: utf-8
from django.conf.urls import url
from django.conf import settings
from django.views.decorators.cache import cache_page
from . import views
urlpatterns = [
# without cache
url(r'^$', views.ListPosts.as_view(), name='page_index'),
url(r'^post/author/(?P<author>[a-zA-Z0-9\-]+)/$', views.ListP... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,482 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/migrations/0002_auto_20151019_2144.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('acrux_blog', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='tag',
... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,483 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/tests/functional/tests_urls.py | #coding: utf-8
from django.test import TestCase, Client
from django.contrib.auth.models import User
from ...models import Post, Tag
class PostTest(TestCase):
def setUp(self):
self.tag1 = Tag.objects.create(name='Esportes')
self.tag2 = Tag.objects.create(name='Cinema')
self.author1 = User.... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,484 | douglasbastos/acrux_blog | refs/heads/master | /setup.py | # coding: utf-8
from setuptools import find_packages, setup
setup(
name='acrux_blog',
description='Blog que adiciona dados em um Banco Relacional e no Redis, para seu comparativo',
author='Douglas Bastos',
author_email='douglashsb@gmail.com',
url='',
version='0.0.1',
packages=find_packages(... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,485 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/models.py | # coding: utf-8
from django.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
class Tag(models.Model):
name = models.CharField('Categoria', max_length=55, unique=True)
slug = models.SlugField('Slug')
def __unicode__(self):
return self.... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,486 | douglasbastos/acrux_blog | refs/heads/master | /acrux_blog/admin.py | # coding: utf-8
from django.contrib import admin
from .models import Post, Tag
class TagAdmin(admin.ModelAdmin):
list_display = ('name',)
fieldsets = ((None, {
'fields': ('name',),
}),)
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'subtitled', 'slug',
'dat... | {"/acrux_blog/tests/functional/test_views.py": ["/acrux_blog/views.py"], "/acrux_blog/views.py": ["/acrux_blog/models.py"], "/acrux_blog/tests/functional/tests_urls.py": ["/acrux_blog/models.py"], "/acrux_blog/admin.py": ["/acrux_blog/models.py"]} |
56,490 | beppe712/honours-project | refs/heads/master | /HDL_gen/ssd_wrapper_gen.py | from hdl_utils import *
def gen_ssd_wrapper(r,outpath="ssd_wrapper.sv"):
outfile = open(outpath,'w+')
outfile.write(gen_heading())
outfile.write(gen_description("ssd_wrapper","Two Seven Segment Display Wrapper","ssd_driver"))
module_io = """
module ssd_wrapper(
input CLK,
input DONE,
input [{}:0] OUT,... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,491 | beppe712/honours-project | refs/heads/master | /DICE/utils.py | import re
import itertools
# Check string file
def check_string(string):
for char in string:
if char not in ['A','C','G','T']:
return False
return True
# Pattern for generating CBGs
def gen_pattern(pat, g):
m = len(pat)
wild = '.'
cbgs = list()
wild_indices = itertools.combinations(range(m+g),g)
for wild_... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,492 | beppe712/honours-project | refs/heads/master | /DICE/rand_dna_gen.py | import sys
from random import randint
def gen_rand_dna(str_len, file_name):
outfile = open(file_name,'w+')
alphabet = ['A','C','G','T']
string = ""
for i in range(str_len):
string += alphabet[randint(0,3)]
outfile.write(string)
outfile.close()
def main():
str_len = int(raw_input("Insert string length: ")... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,493 | beppe712/honours-project | refs/heads/master | /HDL_gen/clu_gen.py | import sys
from hdl_utils import *
import itertools
def gen_cbg(m,g):
cbgs = list()
wild_indices = itertools.combinations(range(m+g),g)
for wild_index in wild_indices:
j = 0 # counter for pattern index
cbg = '('
for i in range(m+g):
if i not in wild_index:
cbg += '(STR[{}] == PAT[{}])'.format(i,j)
... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,494 | beppe712/honours-project | refs/heads/master | /HDL_gen/buf_gen.py | from hdl_utils import *
def gen_buf(m,g,r,str_len,outpath="buffer.sv",sim=False):
outfile = open(outpath,'w+')
outfile.write(gen_heading())
outfile.write(gen_description("buffer","String and Pattern buffer","None"))
module_io = """
module buffer(
input CLK,
input RESET,
input [1:0] BUTTONS,
output... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,495 | beppe712/honours-project | refs/heads/master | /DICE/search.py | import sys
import time
import datetime
from utils import *
# Print
def print_matches(matches, resultpath):
if resultpath:
resultfile = open(resultpath, 'w+')
if not matches:
print("No matches found")
return
for match in matches:
print(match)
if resultpath:
resultfile.write(('{} {}\n'.format(match[0],ma... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,496 | beppe712/honours-project | refs/heads/master | /DICE/pat_to_bin.py | from string_to_bin import *
def main():
stringfpath = sys.argv[1]
outpath = "vivado-project/vivado-project.srcs/sources_1/imports/DICE/pat.txt"
if len(sys.argv) > 2:
outpath = sys.argv[2]
make_bin(stringfpath,outpath)
if __name__ == "__main__":
# execute only if run as a script
main()
| {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,497 | beppe712/honours-project | refs/heads/master | /HDL_gen/top_gen.py | from hdl_utils import *
def gen_top(m,g,r,outpath="top.sv"):
outfile = open(outpath,'w+')
outfile.write(gen_heading())
outfile.write(gen_description("top","Top level module","clu, clu_complex, buffer, ssd_driver, ssd_wrapper"))
module_io = """
module top(
input CLK,
input RESET,
input [1:0] BUTTONS,
... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,498 | beppe712/honours-project | refs/heads/master | /decoder.py | import sys
from DICE.utils import *
def decode(string_file, m, g, r, result_file):
stringfile = open(string_file, 'r')
string = stringfile.read()
stringfile.close()
resultfile = open(result_file, 'r')
results = resultfile.readlines()
results = [line.strip() for line in results]
str_len = len(string)
for i,... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,499 | beppe712/honours-project | refs/heads/master | /DICE/string_to_bin.py | import sys
from utils import *
def make_bin(stringfpath, outpath, m=0, g=0, r=0):
stringfile = open(stringfpath, 'r')
string = stringfile.read()
stringfile.close()
string.upper()
if not check_string(string):
print('The string contains an invalid character')
outfile = open(outpath, 'w+')
bin_list = gen_bin_s... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,500 | beppe712/honours-project | refs/heads/master | /HDL_gen/clu_complex_gen.py | from hdl_utils import *
def gen_clu_complex(m,g,r,outpath="clu_complex.sv"):
outfile = open(outpath,'w+')
outfile.write(gen_heading())
outfile.write(gen_description("clu_complex","Comparison Logic Unit","clu"))
module_io = """
module clu_complex(
input [1:0] STR[0:{}],
input [1:0] PAT[0:{}],
output [{}:0... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,501 | beppe712/honours-project | refs/heads/master | /HDL_gen/hdl_utils.py | import time
import datetime
# indent_level = 0
def gen_heading():
return "`timescale 1ns / 1ps\n`default_nettype wire\n"
def gen_description(module="", descr="", depends=""):
comment_lines = "//////////////////////////////////////////////////////////////////////////////////\n"
company = "// Company: The Universit... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,502 | beppe712/honours-project | refs/heads/master | /make_sys.py | from DICE.string_to_bin import make_bin
from HDL_gen.buf_gen import gen_buf
from HDL_gen.clu_complex_gen import gen_clu_complex
from HDL_gen.clu_gen import gen_clu
from HDL_gen.ssd_wrapper_gen import gen_ssd_wrapper
from HDL_gen.top_gen import gen_top
import os
import errno
import sys
from subprocess import call
stri... | {"/decoder.py": ["/DICE/utils.py"], "/make_sys.py": ["/DICE/string_to_bin.py", "/HDL_gen/buf_gen.py", "/HDL_gen/clu_complex_gen.py", "/HDL_gen/clu_gen.py", "/HDL_gen/ssd_wrapper_gen.py", "/HDL_gen/top_gen.py"]} |
56,503 | williamium3000/pytorch-DQN | refs/heads/main | /test.py | import numpy as np
import torch
t = torch.tensor([[1, 4, 5], [2, 3, 7], [4, 6, 9]])
print(np.argmax(t, axis=1))
| {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,504 | williamium3000/pytorch-DQN | refs/heads/main | /agent_pong.py | import sys
import os
sys.path.append("DQN")
import Q_network_pong
import numpy as np
import torch
from torch import nn
from torch.optim import lr_scheduler
import copy
class DQN_agent():
def __init__(self, num_act, dim_obs, gamma, lr, e_greedy, e_greed_decrement):
self.model = Q_network_pong.Q_network(dim_o... | {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,505 | williamium3000/pytorch-DQN | refs/heads/main | /Q_network.py | import torch
from torch import nn
import random
import numpy as np
import torchvision
import torchvision.utils
import torch
import torch.nn as nn
from torchvision import models
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
... | {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,506 | williamium3000/pytorch-DQN | refs/heads/main | /train.py | import gym
import sys
import agent
import Q_network
import experience_replay
import torch
import numpy as np
import logging
from torch.utils.tensorboard import SummaryWriter
def run_episode(env, agent, rpm):
total_reward = 0
obs = env.reset()
step = 0
while True:
step += 1
action = agen... | {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,507 | williamium3000/pytorch-DQN | refs/heads/main | /Q_network_pong.py | import torch
from torch import nn
import random
import numpy as np
import torchvision
import torchvision.utils
import torch
import torch.nn as nn
from torchvision import models
class ravel(nn.Module):
def __init__(self):
super(ravel, self).__init__()
def forward(self, x):
return x.view(x.shape[... | {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,508 | williamium3000/pytorch-DQN | refs/heads/main | /eval.py | import sys
import agent
import Q_network
import experience_replay
import gym
import numpy as np
import torch
def evaluate(times, env, agent, render=False):
with torch.no_grad():
eval_reward = []
for i in range(times):
obs = env.reset()
episode_reward = 0
while Tr... | {"/agent_pong.py": ["/Q_network_pong.py"], "/train.py": ["/Q_network.py"], "/eval.py": ["/Q_network.py"]} |
56,509 | harzo/reward-calculator | refs/heads/master | /common.py | from decimal import Decimal
import typing
AVERAGE_BLOCK_TIME_SECONDS = 600
AVERAGE_BLOCKS_COUNT_PER_DAY = 144
DAY_IN_SECONDS = 24 * 60 * 60
def average(_list: typing.Collection):
if len(_list) == 0:
return 0
return sum(_list) / len(_list)
def share_to_hashrate(share: int, _seconds: int) -> Decima... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,510 | harzo/reward-calculator | refs/heads/master | /btccom.py | import logging
from datetime import datetime, date, timedelta
from decimal import Decimal
from typing import TypedDict, TypeVar, Generic, Optional, Tuple, List, NamedTuple, Dict
import pytz
from apiclient import APIClient, retry_request, endpoint, JsonResponseHandler, JsonRequestFormatter
from common import DAY_IN_SE... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,511 | harzo/reward-calculator | refs/heads/master | /__main__.py | import argparse
import logging
import pytz as pytz
import sys
from btccom import BtcComData
from common import difficulty_to_hashrate, AVERAGE_BLOCKS_COUNT_PER_DAY, DAY_IN_SECONDS, satoshi_to_btc
from datetime import datetime
from reward import calculate_fpps
parser = argparse.ArgumentParser(prog='reward-calculator',... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,512 | harzo/reward-calculator | refs/heads/master | /reward.py | from decimal import Decimal
def calculate_pps(user_hashrate: int, network_hashrate: int, blocks_rewards: Decimal):
if not network_hashrate:
return Decimal(0)
return Decimal(user_hashrate)/Decimal(network_hashrate) * Decimal(blocks_rewards)
def calculate_fpps(user_hashrate: int, network_hashrate: int... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,513 | harzo/reward-calculator | refs/heads/master | /tests/test_reward.py | from decimal import Decimal
import pytest
from common import AVERAGE_BLOCKS_COUNT_PER_DAY, share_to_hashrate, difficulty_to_hashrate
from reward import calculate_fpps
daily_stats = [
(20823531150111.52, AVERAGE_BLOCKS_COUNT_PER_DAY, 153, 6.25, 146.92, 54262120448, 0.01878856),
(20823531150111.52, AVERAGE_BLO... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,514 | harzo/reward-calculator | refs/heads/master | /tests/test_btccom.py | from datetime import datetime
from decimal import Decimal
from btccom import BtcComClient, BtcComData
client = BtcComClient()
data = BtcComData()
def test_get_blocks_list_on_01012021():
d = datetime.strptime('2021-01-01', "%Y-%m-%d").date()
block_list = client.get_block_list(d)
assert len(block_list['d... | {"/btccom.py": ["/common.py"], "/__main__.py": ["/btccom.py", "/common.py", "/reward.py"], "/tests/test_reward.py": ["/common.py", "/reward.py"], "/tests/test_btccom.py": ["/btccom.py"]} |
56,515 | ataddei/r22sdf | refs/heads/master | /r22sdf.py | from myhdl import *
from math import *
from numpy import *
def Butterfly (i_data_a,i_data_b,o_data_a,o_data_b):
@always_comb
def bf():
o_data_a.next=i_data_a+i_data_b
o_data_b.next=i_data_a-i_data_b
return bf
def Butterfly21 (i_control_s,i_data_aa,i_data_bb,o_data_aa,o_data_bb):
selfc... | {"/r22sdf_tb.py": ["/r22sdf.py", "/test_r22sdf.py"]} |
56,516 | ataddei/r22sdf | refs/heads/master | /r22sdf_tb.py | import myhdl
from myhdl import *
from math import *
from numpy import *
from r22sdf import *
import unittest
from random import *
from test_r22sdf import gen_bitreverse
N_LOG2 = 4
N=2**N_LOG2
TF_WDTH = 8
DIN_WDTH = 8
META_WDTH = 1
DOUT_WDTH = 11
def gen_check(stim):
fft_reference = (fft.fft( [ complex(i[0],i... | {"/r22sdf_tb.py": ["/r22sdf.py", "/test_r22sdf.py"]} |
56,517 | ataddei/r22sdf | refs/heads/master | /test_r22sdf.py | import myhdl
from myhdl import *
from math import *
from numpy import *
from r22sdf import *
import unittest
from random import *
import pdb
Ntest = 0
class TestDefault(unittest.TestCase):
def setUp(self):
self.N=4
self.n_bf=1
self.latency=self.N-1
self.collect=[]
self.a=S... | {"/r22sdf_tb.py": ["/r22sdf.py", "/test_r22sdf.py"]} |
56,520 | edv862/djangonto | refs/heads/master | /apps/rdf_manager/migrations/0002_auto_20180531_1756.py | # Generated by Django 2.0.5 on 2018-05-31 17:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rdf_manager', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='ontology',
name='namespaces',
... | {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,521 | edv862/djangonto | refs/heads/master | /apps/rdf_manager/apps.py | from django.apps import AppConfig
class RdfManagerConfig(AppConfig):
name = 'rdf_manager'
| {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,522 | edv862/djangonto | refs/heads/master | /apps/rdf_manager/admin.py | from django.contrib import admin
from .models import NameSpace, Ontology, OntoFile
admin.site.register(NameSpace)
admin.site.register(Ontology)
admin.site.register(OntoFile)
| {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,523 | edv862/djangonto | refs/heads/master | /graph.py | import rdflib
from rdflib.namespace import Namespace, NamespaceManager
import pprint
graph = rdflib.Graph()
graph.parse('912-onto-ontologies/912-onto/root-ontology.owl')
#graph.parse('n3-ontology.rdf', format='n3')
# aux = graph.subject_objects(
# predicate=rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#l... | {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,524 | edv862/djangonto | refs/heads/master | /apps/rdf_manager/models.py | from django.db import models
class NameSpace(models.Model):
name = models.CharField(max_length=30)
uri = models.CharField(max_length=50)
def __str__(self):
return self.name
class Ontology(NameSpace):
namespaces = models.ManyToManyField(
'Namespace',
related_name='ontology_namespaces',
blank=True,
)
o... | {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,525 | edv862/djangonto | refs/heads/master | /apps/rdf_manager/rdf_functions.py | import rdflib
from rdflib.namespace import Namespace, NamespaceManager
def load_graph(fname):
# Create and load Graph from file
graph = rdflib.Graph()
graph.parse('912-onto-ontologies/912-onto/root-ontology.owl')
# Define & Bind custom ontologies namespaces to the graph
ssn_namespace = Namespace('http://www.w3.o... | {"/apps/rdf_manager/admin.py": ["/apps/rdf_manager/models.py"]} |
56,528 | chawallid/UCF101FewShot | refs/heads/master | /test.py | import torch
import os
import sys
import argparse
import torch.nn.functional as F
from models import R2Plus1D, Resnet
from torch.utils.data import DataLoader
from torch.autograd import Variable
from UCF101 import UCF101, CategoriesSampler
from utils import printer, mean_confidence_interval
if __name__ == "__main__":
... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,529 | chawallid/UCF101FewShot | refs/heads/master | /models.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models import resnet18, resnet50
from torchvision.models.video import r2plus1d_18
from torchvision.models.video.resnet import BasicBlock, Conv2Plus1D
from utils import freeze_all, freeze_layer, freeze_bn, initialize_linear, initialize_3... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,530 | chawallid/UCF101FewShot | refs/heads/master | /few_sequence_detector.py | import os
from glob import glob
frames_path = "../Data/UCF101/UCF101_frames/"
hit_sequence_length = 35
frames_path_list = glob(os.path.join(frames_path, "*"))
# check total videos(from frames path)
print("total videos: {}".format(len(frames_path_list)))
counter = 0
for frame_path in frames_path_list:
sequence_l... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,531 | chawallid/UCF101FewShot | refs/heads/master | /splitter.py | import os
import glob
import numpy as np
import pandas as pd
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--frames-path", type=str, default="../UCF101FrameExtractor/UCF101_frames/")
parser.add_argument("--save-path", type=str, default="./UCF101_few_shot_labels/")
parser.add_argument("--categ... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,532 | chawallid/UCF101FewShot | refs/heads/master | /train.py | import torch
import os
import sys
import argparse
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from torch.autograd import Variable
from utils import path_check, args_print_save, printer
from models import R2Plus1D, Resnet
from UCF101 import UC... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,533 | chawallid/UCF101FewShot | refs/heads/master | /utils.py | import os
import sys
import shutil
import scipy.stats as stats
import numpy as np
import torch.nn as nn
def printer(status, epoch, num_epochs, batch, num_batchs, loss, loss_mean, acc, acc_mean):
sys.stdout.write("\r[{}]-[Epoch {}/{}] [Batch {}/{}] [Loss: {:.4f} (mean: {:.4f}), Acc: {:.2f}% (mean: {:.2f}%)] ".forma... | {"/test.py": ["/models.py", "/utils.py"], "/models.py": ["/utils.py"], "/train.py": ["/utils.py", "/models.py"]} |
56,558 | Niektory/Danmaku | refs/heads/master | /scripts/client.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
import time
from config import version
from network import ClientConnection
class Client(object):
def run(self):
print("Welcome to {} {} client!".format(version.game_name, version.version))
with ClientConn... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,559 | Niektory/Danmaku | refs/heads/master | /scripts/incident.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from deck import Deck
class IncidentDeck(Deck):
def __init__(self):
Deck.__init__(self, "Incident Deck")
self.deck = ["crisis of faith", "crossing to Higan", "endless party", "eternal night",
"five impossible requests", "great barrier weakeni... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,560 | Niektory/Danmaku | refs/heads/master | /run_server.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
from scripts.error import LogException
if __name__ == '__main__':
with LogException():
from scripts.server import Server
server = Server()
server.run()
| {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,561 | Niektory/Danmaku | refs/heads/master | /scripts/deck.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
import random
class Deck(object):
def __init__(self, name="deck"):
self.deck = []
self.name = name
def shuffle(self):
random.shuffle(self.deck)
def draw(self):
return self.deck.pop()
def findCard(self, to_find):
for card in self.deck... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,562 | Niektory/Danmaku | refs/heads/master | /scripts/server.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
from config import version
from network import ServerConnections
from gamesession import GameSession
class Server(object):
def run(self):
print("Welcome to {} {} server!".format(version.game_name, version.ver... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,563 | Niektory/Danmaku | refs/heads/master | /scripts/network.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
import socket
import select
IP = "127.0.0.1"
PORT = 12347
BUFFER_SIZE = 4096
class ServerConnections(object):
def __enter__(self):
self.connections = []
self.users = []
self.server_socket = socket.socket... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,564 | Niektory/Danmaku | refs/heads/master | /scripts/maindeck.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
import copy
from deck import Deck
class MainDeck(Deck):
def __init__(self, discard_pile):
Deck.__init__(self, "Main Deck")
self.deck = []
for card, number in DEFAULT_MAIN_DECK.iteritems():
for i in xr... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,565 | Niektory/Danmaku | refs/heads/master | /run_client.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
from scripts.error import LogException
if __name__ == '__main__':
with LogException():
from scripts.client import Client
client = Client()
client.run()
| {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,566 | Niektory/Danmaku | refs/heads/master | /scripts/gamesession.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from __future__ import print_function
from player import Player
import gamestate
class GameSession(object):
def __init__(self):
self.state = [gamestate.PlayTurns(self), gamestate.DealHands(self),
gamestate.InitLife(self), gamestate.RevealHeroi... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,567 | Niektory/Danmaku | refs/heads/master | /scripts/character.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from deck import Deck
class CharacterDeck(Deck):
def __init__(self):
Deck.__init__(self, "Character Deck")
self.deck = ["Alice", "Cirno", "Reimu", "Byakuren", "Tenshi", "Meiling", "Suika",
"Sakuya", "Keine", "Nitori", "Yuuka", "Marisa", "Sana... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,568 | Niektory/Danmaku | refs/heads/master | /scripts/player.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from deck import Deck
DEFAULT_LIFE = 4
DEFAULT_HAND_SIZE = 4
DEFAULT_RANGE = 1
class Player(object):
def __init__(self, name):
self.name = name
self.role = None
self.character = None
self.life = DEFAULT_LIFE
self.hand = Deck()
self.defe... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,569 | Niektory/Danmaku | refs/heads/master | /scripts/config/version.py | # -*- coding: utf-8 -*-
game_name = "Danmaku!!"
version = "0.0"
| {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,570 | Niektory/Danmaku | refs/heads/master | /scripts/role.py | # -*- coding: utf-8 -*-
# Copyright 2018 Tomasz "Niektóry" Turowski
from deck import Deck
class RoleDeck(Deck):
def __init__(self, players, simplified=False):
Deck.__init__(self, "Role Deck")
partner_deck = PartnerDeck(players, simplified)
stage_boss_deck = StageBossDeck(players, simplified)
ex_boss_deck = ... | {"/run_server.py": ["/scripts/server.py"], "/run_client.py": ["/scripts/client.py"]} |
56,571 | hypebeast/bundesliga-cli | refs/heads/master | /bundesliga/cli.py | # -*- coding: utf-8 -*-
import click
from .openligadb import OpenLigaDB
from . import helpers
pass_openligadb = click.make_pass_decorator(OpenLigaDB)
@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx):
"""
Bundesliga results and stats for hackers.
bundesliga-cli is a CLI tool t... | {"/bundesliga/cli.py": ["/bundesliga/openligadb.py"]} |
56,572 | hypebeast/bundesliga-cli | refs/heads/master | /bundesliga/helpers.py | # -*- coding: utf-8 -*-
import datetime
from prettytable import PrettyTable
def parseDateTime(time):
return datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%S')
def from_utc(utcTime, fmt="%Y-%m-%dT%H:%M:%S.%fZ"):
"""
Convert UTC ISO-8601 time string to time.struct_time
"""
return datetime.date... | {"/bundesliga/cli.py": ["/bundesliga/openligadb.py"]} |
56,573 | hypebeast/bundesliga-cli | refs/heads/master | /setup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys, subprocess
import bundesliga
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
subprocess.call(['python', 'setup.py', 'sdist', 'upload', '--sign'])
sys.exit()
README = op... | {"/bundesliga/cli.py": ["/bundesliga/openligadb.py"]} |
56,574 | hypebeast/bundesliga-cli | refs/heads/master | /bundesliga/openligadb.py | # -*- coding: utf-8 -*-
import json
import re
from urllib.request import urlopen
class OpenLigaDB:
"""
Simple wrapper for http://openligadb-json-api.heroku.com.
"""
ERSTE_LIGA = 'bl1'
ZWEITE_LIGA = 'bl2'
DRITTE_LIGA = 'bl3'
FUSSBALL_SPORT_ID = 1
def __init__(self):
# self.ope... | {"/bundesliga/cli.py": ["/bundesliga/openligadb.py"]} |
56,577 | YamiOmar88/flow-networks | refs/heads/master | /main.py | # main.py
# Author: Yamila Omar
# Date: 22nd May 2018
from graphfile import GraphFile
from graph import Graph
from capacity import Capacity
from fordfulkerson import FordFulkerson
# Input data
# ==========
graph_to_study = input("Choose graph to study: F1, F2 or F3? ")
# Load graph
# ==========
filename = "data/"... | {"/main.py": ["/graphfile.py", "/graph.py"]} |
56,578 | YamiOmar88/flow-networks | refs/heads/master | /graphfile.py | # Useful functions
# Author: Yamila M. Omar
# Date: 4/4/2019
# ======================
class GraphFile:
def __init__(self, fileName):
'''Initialize class with name of file.'''
self.filename = fileName
def read_edges_from_file(self):
'''Read graph from file. The file contains on... | {"/main.py": ["/graphfile.py", "/graph.py"]} |
56,579 | YamiOmar88/flow-networks | refs/heads/master | /graph.py | # Entropy Centrality
# Author: Yamila M. Omar
# Date: 5/4/2019
from math import log
class Graph:
def __init__(self, edges=dict()):
'''Initializes a Graph. Variables:
- edges: dictionary with edge tuples as keys (i,j) and
weight w_ij as values.'''
self.edges = edges
... | {"/main.py": ["/graphfile.py", "/graph.py"]} |
56,581 | zainsci/redbot | refs/heads/master | /popup.py | import tkinter as tk
from tkinter import ttk
import webbrowser
from time import sleep
def open_reddit(permalink, window, interval):
webbrowser.open(f"https://www.reddit.com{permalink}")
window.destroy()
if interval != None:
print(f"If Commenting Wait {interval / 60} Min")
sleep(int(interva... | {"/bot.py": ["/popup.py"]} |
56,582 | zainsci/redbot | refs/heads/master | /bot.py | from popup import notification
import requests
import argparse
from datetime import datetime
from time import sleep
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36"
}
QUESTIONS = ["What is", "What are", "What will"]
def make_reque... | {"/bot.py": ["/popup.py"]} |
56,629 | spawn3/python-util | refs/heads/master | /lich/lich/runner.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import functools
import subprocess
import time
def timethis(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
r = func(*args, **kwargs)
end = time.time()
print('[{}]: {}.{} {} {}'.format(end - start,... | {"/setup.py": ["/ask/__init__.py"]} |
56,630 | spawn3/python-util | refs/heads/master | /ask/algo/ds.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import collections
import itertools
import functools
# collections.defaultdict
# collections.namedtuple
| {"/setup.py": ["/ask/__init__.py"]} |
56,631 | spawn3/python-util | refs/heads/master | /ask/nas/r.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import datetime
import time
from redis import Redis
import json
import traceback
from optparse import OptionParser
from repoze.lru import lru_cache
ROOT_NODEID = '1'
ROOT_PATH = '/'
META = '@'
DEBUG = True
def print2(*args):
if DEBUG:
print... | {"/setup.py": ["/ask/__init__.py"]} |
56,632 | spawn3/python-util | refs/heads/master | /spider/gdc/updatebili.py | #!/usr/bin/python
# coding=utf-8
import pymongo
from webcrawl.handleRequest import requGet
if __name__ == '__main__':
mc = pymongo.MongoClient('localhost')
ddj = mc['dandan-jiang']
for one in ddj.video.find({'src':'哔哩哔哩'}):
if not 'mp4' in one['url']:
print one['_id'] | {"/setup.py": ["/ask/__init__.py"]} |
56,633 | spawn3/python-util | refs/heads/master | /spider/gdc/setting.py | #!/usr/bin/env python
# coding=utf-8
USER = 'root'
SECRET = '900150983cd24fb0d6963f7d28e17f72'
HOST = 'http://127.0.0.1:7001/'
| {"/setup.py": ["/ask/__init__.py"]} |
56,634 | spawn3/python-util | refs/heads/master | /ask/func/gen.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import types
import itertools
from contextlib import contextmanager
def fibonacci():
a, b = 0, 1
while True:
yield b
a, b = b, a + b
def f(*args, **kwargs):
print args
print kwargs
def gensquares(N):
for i in range(N):... | {"/setup.py": ["/ask/__init__.py"]} |
56,635 | spawn3/python-util | refs/heads/master | /lich/utils.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
def GB(n):
return n * 1024 * 1024 * 1024
def timeit():
pass
def list_is_equal(l1, l2):
if len(l1) != len(l2):
return False
for x in l1:
if x not in l2:
return False
return True
| {"/setup.py": ["/ask/__init__.py"]} |
56,636 | spawn3/python-util | refs/heads/master | /ask/right/__init__.py | # from .. import util
from b import (BA)
from exceptions import (AError, BError)
__all__ = ['BA', 'AError', 'BError']
print '...import package %s' % __name__
| {"/setup.py": ["/ask/__init__.py"]} |
56,637 | spawn3/python-util | refs/heads/master | /spider/gdc/task/role/spiderRole.py | #!/usr/bin/env python
# coding=utf-8
import os, re, copy, json, time, commands
from pymongo import MongoClient
from datetime import timedelta
from datetime import datetime
from webcrawl.handleRequest import requGet
from webcrawl.handleRequest import requPost
from webcrawl.handleRequest import getHtmlNodeContent
from we... | {"/setup.py": ["/ask/__init__.py"]} |
56,638 | spawn3/python-util | refs/heads/master | /lich/base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from lich.umptypes import UmpPath
from lich.pool import LichPool
from lich.volume import LichVolume
from lich.snapshot import LichSnapshot
RET_OK = 0
class TestBase(unittest.TestCase):
def setUp(self):
self.lich_pool = LichPool()
... | {"/setup.py": ["/ask/__init__.py"]} |
56,639 | spawn3/python-util | refs/heads/master | /spider/gdc/task/comic/spiderHentai.py | #!/usr/bin/env python
# coding=utf-8
import os, re, copy, json, time, random
from pymongo import MongoClient
from datetime import timedelta
from datetime import datetime
from webcrawl.request import requGet
from webcrawl.request import requPost
from webcrawl.request import getHtmlNodeContent
from webcrawl.request impor... | {"/setup.py": ["/ask/__init__.py"]} |
56,640 | spawn3/python-util | refs/heads/master | /lich/lich/base.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import json
import traceback
import sys
from pprint import pprint
class LichSetting(object):
def __init__(self):
self.lich_home = '/opt/fusionstack'
class LichBase(object):
def __init__(self):
self.settings = LichSetting()
self.lich_ho... | {"/setup.py": ["/ask/__init__.py"]} |
56,641 | spawn3/python-util | refs/heads/master | /setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from ask import __version__
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
f = open(os.path.join(os.path.dirname(__file__), 'README.md'))
long_description = f.read()
f.close()
setup(
name='ask... | {"/setup.py": ["/ask/__init__.py"]} |
56,642 | spawn3/python-util | refs/heads/master | /spider/gdc/webcrawl/pjq.py | #!/usr/bin/python
# coding=utf-8
import json
import heapq
import redis
import beanstalkc
import threading
import queue
threading.queue = queue
import cPickle as pickle
from bson import ObjectId
from character import unicode2utf8
try:
from kokolog.aboutfile import modulename, modulepath
from kokolog.prettyprin... | {"/setup.py": ["/ask/__init__.py"]} |
56,643 | spawn3/python-util | refs/heads/master | /ask/th.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread
class MyThread(Thread):
def __init__(self):
pass | {"/setup.py": ["/ask/__init__.py"]} |
56,644 | spawn3/python-util | refs/heads/master | /stock/lib/tjts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import argparse
from prettytable import PrettyTable
def stock_list(begin_price, end_price, factor=0.04, partition=4, money=20000):
pt = PrettyTable(['IDX', 'Buy', 'Sell', 'Diff', 'Diff/4', 'Partition', 'Money', 'Stock1', "Stock2"])
pt.hrules = 1
... | {"/setup.py": ["/ask/__init__.py"]} |
56,645 | spawn3/python-util | refs/heads/master | /ask/__init__.py | __version__ = '0.1.0'
VERSION = tuple(map(int, __version__.split('.')))
print '...import package ask'
| {"/setup.py": ["/ask/__init__.py"]} |
56,646 | spawn3/python-util | refs/heads/master | /ask/dt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
def get_daystr(dt=None, day=0):
if not dt:
dt = datetime.datetime.now()
dt += datetime.timedelta(days=day)
return '%04d%02d%02d' % (dt.year, dt.month, dt.day)
def total_seconds(delta):
return delta.days * 3600 * 24 + delta.secon... | {"/setup.py": ["/ask/__init__.py"]} |
56,647 | spawn3/python-util | refs/heads/master | /test/all.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
class TestPool(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_stat(self):
self.assertEqual(0, 1)
def test_list(self):
self.assertEqual(1, 1)
def suite():
s = unittest.T... | {"/setup.py": ["/ask/__init__.py"]} |
56,648 | spawn3/python-util | refs/heads/master | /ask/clss/mc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class MyMeta(type):
def __new__(cls, name, parents, dct):
print 'A new class named ' + name + ' is going to be created'
return super(MyMeta, cls).__new__(cls, name, parents, dct)
class MyClass(object):
__metaclass__ = MyMeta
| {"/setup.py": ["/ask/__init__.py"]} |
56,649 | spawn3/python-util | refs/heads/master | /lich/all.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import unittest
import test_pool
import test_volume
import test_snapshot
class TestPool(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_stat(self):
self.assertEqual(0, 0)
def test_list(self):
... | {"/setup.py": ["/ask/__init__.py"]} |
56,650 | spawn3/python-util | refs/heads/master | /lich/lich/syncump.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from base import LichBase, RemoteLocation
from runner import http_runner
class LichSyncumpParam(RemoteLocation):
def __init__(self, host_ip=None):
super(LichSyncumpParam, self).__init__(host_ip)
class LichSyncump(LichBase):
@http_runner()
def get_... | {"/setup.py": ["/ask/__init__.py"]} |
56,651 | spawn3/python-util | refs/heads/master | /spider/gdc/grab.py | #!/usr/bin/env python
# coding=utf-8
import time, datetime, copy
import os, sys, json
import random
import traceback
from model.setting import withData, datacfg, WORKNUM, WORKQUEUE
from model.log import ProxyLog, Statistics, Log
from model.data import Proxy
from webcrawl.request import PROXY, requGet, requPost
from w... | {"/setup.py": ["/ask/__init__.py"]} |
56,652 | spawn3/python-util | refs/heads/master | /lich/test_volume.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from pprint import pprint
from lich.umptypes import UmpPath
from base import TestBase
class TestAll(TestBase):
def setUp(self):
super(TestAll, self).setUp()
self.pool_name = UmpPath('volume.a')
self.volume_name = UmpPath('... | {"/setup.py": ["/ask/__init__.py"]} |
56,653 | spawn3/python-util | refs/heads/master | /ask/io.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import redis
def test_file():
with open('io.py') as f:
for line in f:
line = line.strip('\n')
print line
| {"/setup.py": ["/ask/__init__.py"]} |
56,654 | spawn3/python-util | refs/heads/master | /ask/object_cache.py | # -*- coding: UTF-8 -*-
import objcache
class ObjectCache(objcache.ObjectCache):
def __init__(self):
super(ObjectCache, self).__init__()
def cache_get_or_create(name, load_func, expire=600):
cache_name = name + 'Cache'
if not ObjectCache.exists(cache_name):
ObjectCache.create(load_func... | {"/setup.py": ["/ask/__init__.py"]} |
56,655 | spawn3/python-util | refs/heads/master | /lich/config.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
class VolumeConfig(object):
def __init__(self, name, snapshots=['snap_01'], cloned_volumes=['clone_01']):
self.name = name
self.snapshots = snapshots
self.cloned_volumes = cloned_volumes
self.size = 1024*1024*1024
self.new_siz... | {"/setup.py": ["/ask/__init__.py"]} |
56,656 | spawn3/python-util | refs/heads/master | /ask/web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tornado
import tornado.ioloop
import tornado.web
import tornado.httpclient
import tornado.gen
from tornado.httpserver import HTTPServer
class BaseHandler(tornado.web.RequestHandler):
def prepare(self):
pass
def initialize(self):
pass
... | {"/setup.py": ["/ask/__init__.py"]} |
56,657 | spawn3/python-util | refs/heads/master | /ask/func/decorator.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
enable_tracing = True
if enable_tracing:
debug_log = open('debug.log', 'w')
def trace(func):
if enable_tracing:
def callf(*args, **kwargs):
debug_log.write('Calling %s: %s, %s\n' % (func.__name__, args, kwargs))
... | {"/setup.py": ["/ask/__init__.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.