index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
30,269 | Kronholt/harding | refs/heads/master | /events/migrations/0005_post_full_story.py | # Generated by Django 3.1.2 on 2021-01-07 16:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0004_comment'),
]
operations = [
migrations.AddField(
model_name='post',
name='full_story',
fi... | {"/events/filters.py": ["/events/models.py"], "/events/forms.py": ["/events/models.py"], "/events/views.py": ["/events/filters.py", "/events/forms.py", "/events/models.py"]} |
30,270 | Kronholt/harding | refs/heads/master | /events/migrations/0002_post_tag.py | # Generated by Django 3.1.2 on 2021-01-07 13:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Tag',
fiel... | {"/events/filters.py": ["/events/models.py"], "/events/forms.py": ["/events/models.py"], "/events/views.py": ["/events/filters.py", "/events/forms.py", "/events/models.py"]} |
30,271 | Kronholt/harding | refs/heads/master | /events/forms.py | from .models import Comment
from django.forms import ModelForm
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class CommentForm(ModelForm):
message = forms.CharField(widget=forms.Textarea(attrs={"rows":3}))
class Meta:
model ... | {"/events/filters.py": ["/events/models.py"], "/events/forms.py": ["/events/models.py"], "/events/views.py": ["/events/filters.py", "/events/forms.py", "/events/models.py"]} |
30,272 | Kronholt/harding | refs/heads/master | /events/views.py | from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth import authenticate, login, logout
from .filters import PostFilter
from django.contrib.auth.forms import UserCreationForm
from .forms import CommentForm, CreateUserForm
from .models import *
from .decorators impo... | {"/events/filters.py": ["/events/models.py"], "/events/forms.py": ["/events/models.py"], "/events/views.py": ["/events/filters.py", "/events/forms.py", "/events/models.py"]} |
30,324 | hiratara/offline-DOUKAKU-skeletons | refs/heads/master | /answer.py | def solve(input):
return input
| {"/test.py": ["/answer.py"]} |
30,325 | hiratara/offline-DOUKAKU-skeletons | refs/heads/master | /test.py | import unittest
from answer import solve
class TestSequenceFunctions(unittest.TestCase):
def test(self):
with open('patterns.tsv') as f:
for line in f:
num, inputted, expected = line.rstrip().split("\t")
self.assertEqual(
solve(inputted), expe... | {"/test.py": ["/answer.py"]} |
30,332 | choyi0521/stock-gan-test | refs/heads/master | /models/convolutional_models.py | import torch
import torch.nn as nn
from modules.tcn import TemporalConvNet
class TCNGenerator(nn.Module):
def __init__(self,
noise_dim: int,
output_dim: int,
hidden_dim: int,
lcond_dim: int = 0,
gcond_dim: int = 0,
... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,333 | choyi0521/stock-gan-test | refs/heads/master | /gan_trainer.py | import torch
import torch.nn
from torch_trainer import TorchTrainer
from models.recurrent_models import LSTMGenerator, LSTMDiscriminator
from models.convolutional_models import TCNGenerator, TCNDiscriminator
from torch.utils.data import DataLoader
class LSTMGANTrainer(TorchTrainer):
def __init__(self, n_epochs, b... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,334 | choyi0521/stock-gan-test | refs/heads/master | /etf_dataset.py | import torch
from torch.utils.data import Dataset
class ETFDataset(Dataset):
def __init__(self, etfs, seq_len, max_pred_steps, scaler):
self.etfs = etfs
self.seq_len = seq_len
self.max_pred_steps = max_pred_steps
self.scaler = scaler
self.block_size = self.etfs.shape[0] - ... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,335 | choyi0521/stock-gan-test | refs/heads/master | /main.py | import numpy as np
import pandas as pd
from pandas_datareader.data import DataReader
from datetime import datetime
etfs = ['VTI', 'EFA', 'EEM', 'TLT', 'TIP', 'VNQ']
train_start = datetime(2005,1,1)
train_end = datetime(2012,12,31)
test_start = datetime(2013,1,1)
test_end = datetime(2014,12,31)
train = DataReader(et... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,336 | choyi0521/stock-gan-test | refs/heads/master | /preprocessor.py | from sklearn.preprocessing import StandardScaler
import numpy as np
class ETFScaler(object):
def __init__(self, etfs: np.array, max_pred_steps: int):
self.scaler = StandardScaler()
self.scaler.fit(etfs)
self.max_pred_steps = max_pred_steps
def transform(self, etfs: np.array, pred_step... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,337 | choyi0521/stock-gan-test | refs/heads/master | /torch_trainer.py | import torch
import numpy as np
import os
import random
class TorchTrainer(object):
def __init__(self):
# set random seed
self.set_random_seed()
# cuda setting
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def train(self):
pass
def va... | {"/gan_trainer.py": ["/torch_trainer.py", "/models/convolutional_models.py", "/preprocessor.py", "/etf_dataset.py"], "/main.py": ["/preprocessor.py"]} |
30,357 | Marvinmw/CLINE | refs/heads/master | /src/lecbert/__init__.py | from .configuration import LecbertConfig
from .datacollator import DataCollatorForLEC
from .modeling import LecbertForPreTraining
from .tokenization import LecbertTokenizer
| {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,358 | Marvinmw/CLINE | refs/heads/master | /src/datamerge.py | import os
import random
from datasets import Dataset, concatenate_datasets
random.seed(12345)
if __name__ == "__main__":
ori_dataset = Dataset.load_from_disk('disk/enwiki_bookcorpus-tiny-disk')
rep_dataset = Dataset.load_from_disk('disk/enwiki_bookcorpus-tiny-wrep-disk')
ori_num = ori_dataset.num_rows
... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,359 | Marvinmw/CLINE | refs/heads/master | /src/wordnet.py | from nltk.corpus import wordnet as wn
#from nltk.stem import WordNetLemmatizer
from lemminflect import getInflection
#wnl = WordNetLemmatizer()
REPLACE_TAG = ['NN', 'NNS', 'JJ', 'JJR', 'JJS', 'RB', 'RBR', 'RBS', 'VB', 'VBD', 'VBG', 'VBN', 'VBP', 'VBZ'] # [NNP, NNPS]
REPLACE_POS = ['NOUN', 'VERB', 'ADJ', 'ADV']
POS_TO... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,360 | Marvinmw/CLINE | refs/heads/master | /src/lecbert/tokenization.py | from transformers import RobertaTokenizer
from typing import List, Optional
REPLACE_NONE = -100
class LecbertTokenizer(RobertaTokenizer):
def build_inputs_with_special_tokens(
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) -> List[int]:
"""
Build model inputs ... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,361 | Marvinmw/CLINE | refs/heads/master | /preprocess/tokenizer_train.py | # -*- coding:utf-8 -*-
import os
from argparse import ArgumentParser
from tokenizers import ByteLevelBPETokenizer, CharBPETokenizer
from tokenizers import normalizers
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("--input_path", type=str, nargs='?', required=True, help="")
parser... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,362 | Marvinmw/CLINE | refs/heads/master | /preprocess/extract_sentence.py | # -*- coding:utf-8 -*-
import os
import sys
import spacy
import re
from multiprocessing import Process
from argparse import ArgumentParser
nlp = spacy.load('en_core_web_sm')
#boundary = re.compile('[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]')
def custom_seg(doc):
length = len(doc)
for index, token in enume... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,363 | Marvinmw/CLINE | refs/heads/master | /src/dataloader.py | import os
from datasets import load_dataset, Dataset
from typing import Optional
from dataclasses import dataclass, field
from transformers import (
HfArgumentParser,
PreTrainedTokenizer
)
from transformers import AutoConfig, AutoTokenizer
import random
import spacy
random.seed(12345)
from spacy.tokens imp... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,364 | Marvinmw/CLINE | refs/heads/master | /src/lecbert/datacollator.py | import torch
from torch.nn.utils.rnn import pad_sequence
from typing import List, Dict, Tuple
from dataclasses import dataclass
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
REPLACE_NONE = -100
@dataclass
class DataCollatorForLEC:
"""
Data collator used for linguistic error correct... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,365 | Marvinmw/CLINE | refs/heads/master | /src/lecbert/configuration.py | from transformers import RobertaConfig
class LecbertConfig(RobertaConfig):
num_token_error = 3
| {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,366 | Marvinmw/CLINE | refs/heads/master | /preprocess/tokenizer_test.py | # -*- coding:utf-8 -*-
import os
from argparse import ArgumentParser
from tokenizers.implementations import ByteLevelBPETokenizer
from tokenizers.processors import BertProcessing, RobertaProcessing
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("--token_path", type=str, nargs='?', req... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,367 | Marvinmw/CLINE | refs/heads/master | /src/lecbert/modeling.py | import warnings
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss, BCELoss
from dataclasses import dataclass
from typing import Optional, Tuple
from transformers.activations import ACT2FN, gelu
from transformers.file_utils import ModelOutput
from transformers.modeling_roberta import R... | {"/src/lecbert/__init__.py": ["/src/lecbert/configuration.py", "/src/lecbert/datacollator.py", "/src/lecbert/modeling.py", "/src/lecbert/tokenization.py"]} |
30,418 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__pyfimm.py | '''
pyFIMM - main module
See help on the main module, `help(pyFIMM)`, for usage info.
In this file are the pyFIMM global parameters - set_wavelength, set_N etc.
See __Classes.py for the higher-level classes, such as Project, Node, Material, Layer, Slice and Section.
Waveguide, Circ and Device classes/functions... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,419 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__CavityMode.py | '''
pyFIMM.CavityMode
Operations on Cavity Modes (modes vs. Z). Created when the user requests:
>>> CavityObj.mode(0)
: returns a <pyFIMM CavityMode object>
Demis D. John, 2015, Praevium Research Inc.
To Do:
------
- Cavity.plot()
- plot lateral fields?
- zmin & zmax - account for LHS_Dev & RHS_Dev... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,420 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/colormap_HotCold.py | # ColorMap
# Red-Black-Blue, like Matlab's 'FireIce' or 'HotCold'
# http://stackoverflow.com/questions/24997926/making-a-custom-colormap-using-matplotlib-in-python
from matplotlib.colors import LinearSegmentedColormap
ltblue = [x/255. for x in (170,170,255)] # set the RBG vals here
ltred = [x/255. for x in (255,1... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,421 | demisjohn/pyFIMM | refs/heads/master | /example5 - open Device from File with Variables v1.py | '''
##########################################################################
Example 5:
Import a Project + Device from File & access the internal variables
##########################################################################
'''
import pyfimm as pf # Every script must begin with this line
... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,422 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/proprietary/ExampleModule.py | '''
pyFIMM/proprietary/ExampleModule.py
This is an example of how to add your own proprietary functionality to pyFIMM.
You could also keep this file outside the main pyFIMM directory and import it in your script,
but importing it as part of pyFIMM gives it access to all the pyFIMM methods etc.
This example module a... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,423 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/PhotonDesignLib/__init__.py | #/usr/bin/python2.7
#
# __init__.py
# Module to load all PhotonDesign Python libraries/modules
# This file will cause the folder it's in to be a Python module
# to be importable as a module, where the module automatically includes
# all the files within the folder.
#
# Taken from here:
# http://stackoverflow.com/que... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,424 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Device.py | '''Device class, part of pyFIMM.'''
from __globals import * # import global vars & FimmWave connection object
# DEBUG() variable is also set in __globals, & numpy as np & pyplot as plt
from __pyfimm import * # import the main module (should already be imported)
# NOTE: shouldn't have to duplicate the en... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,425 | demisjohn/pyFIMM | refs/heads/master | /example2 - Rect Device with material db.py | '''
##########################################################################
Simple FimmProp Device example.
Creates a rectangular WG (RWG) with AlGaAs core using the default material database, `refbase.mat`
Solves for modes & plots the fundamental mode.
Then makes an identical waveguide that is wider, ... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,426 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Mode.py | '''Mode class, part of pyFIMM.'''
from __globals import * # import global vars & FimmWave connection object
# also contains AMF_FolderStr(), DEBUG(), numpy as np & pyplot as plt
from pylab import cm # color maps
import math
import os # for filepath manipulations (os.path.join/os.mkdir/os.path.isdir)
from _... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,427 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/PhotonDesignLib/pdAppclient.py | #pdAppClient (PYTHON version)
from pdPythonLib import *
import sys
from string import *
if len(sys.argv)<3:
print "pdAppClient (PYTHON Version) Syntax:"
print "pdAppClient <portNo> <hostname>"
print "<portNo> = the port number on which the application is serving"
print "<hostname> = the name... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,428 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Classes.py | '''Various smaller Classes, part of pyFIMM.
This module is imported by pyfimm.py
Included here are the following classes:
Node (Inherited by all objects that are actual fwNodes)
Project & import_project()
Material
Layer (Waveguide/Circ)
Slice (Waveguide)
Section (Device)
Also some Node-specific functions such... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,429 | demisjohn/pyFIMM | refs/heads/master | /example4 - open Device from File v1.py | '''
##########################################################################
Example 4:
Import a Project from File, and insert a Device from File into a new Project
##########################################################################
'''
import pyfimm as pf # Every script must begin with t... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,430 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__init__.py | '''pyFIMM Documentation:
pyFIMM provides a python interface to Photon Design's FIMMWAVE/FIMMPROP simulation tools.
The interface is set up like Peter Beinstman's CAMFR (CAvity Modelling FRamework) system, in which 1-D Slices are concatenated to produce arbitrary 2-D index profiles (waveguides), which can be further... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,431 | demisjohn/pyFIMM | refs/heads/master | /example3 - Cyl DFB Cavity v4.py | '''
##########################################################################
Cylindrical waveguide & Device example - a distributed feed-back device
similar to a VCSEL cavity.
Based on the Photon Design web-example:
"Modelling a passive optical cavity (VCSEL, DFB)"
http://www.ph... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,432 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Cavity.py | '''
Cavity Calculation functions
Demis D. John, 2015, Praevium Research Inc.
Based on Peter Beinstman's CAMFR package's `Cavity` class,
and Vincent Brulis' CavityModeCalc.py example script.
'''
from __globals import * # import global vars & FimmWave connection object
# DEBUG() variable is also set in __glo... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,433 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/PhotonDesignLib/pdPythonLib.py | # pdPythonLib version 1.6
# Command Line Interface with Python for Photon Design products
from string import *
from socket import *
from struct import *
from math import ceil
from time import sleep
import os
import re
import __main__
import types
import time # for pausing execution
INTBUFFSIZE = 20 #t... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,434 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Tapers.py | '''Tapered waveguide classes, part of pyFIMM.'''
from __globals import * # import global vars & FimmWave connection object
from __pyfimm import * # import the main module (should already be imported), includes many 'rect' classes/funcs
from __Mode import Mode # import Mode class
from __Wave... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,435 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__globals.py | '''pyFIMM's Global Variables
Contains/defines global variables - most importantly the fimmwave connection object `fimm`.
This separate file is required to prevent circular module imports, and enable nested-modules (eg. in /proprietary/) to use the FimmWave connection.
'''
import numpy as np
import matplotlib.pyplot a... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,436 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Waveguide.py | '''Waveguide class, part of pyFIMM.'''
#from pylab import * # must kill these global namespace imports!
#from numpy import *
from __globals import * # import global vars & FimmWave connection object
from __pyfimm import * # import the main module (should already be imported), includes many 'rect'... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,437 | demisjohn/pyFIMM | refs/heads/master | /example1 - Rect WG.py | '''
##########################################################################
Simple rectangular waveguide example using the FMM solver
Demonstrates basic WG construction & plotting capabilities.
In Spyder, make sure you run the script with the Run > Configure... settings
"Execute in current Python consol... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,438 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__version.py | versionnum = "1.3.3" # the version number
versiondate = "2017-04-20" # the date of this version
version = "v"+versionnum+", "+versiondate
# if this file called by itself, print the version number:
if __name__ == "__main__":
print version
| {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,439 | demisjohn/pyFIMM | refs/heads/master | /pyfimm/__Circ.py | '''Circ class, part of pyFIMM.
Objects & functions needed for cylindrical calculations.'''
from __globals import * # import global vars & FimmWave connection object
# DEBUG() variable is also set in __globals
from __pyfimm import * # access the main module's classes & modesolver functions
#from __Wave... | {"/pyfimm/proprietary/ExampleModule.py": ["/pyfimm/__globals.py", "/pyfimm/__Waveguide.py"], "/example3 - Cyl DFB Cavity v4.py": ["/pyfimm/__init__.py"]} |
30,442 | rossng/clrs-sorts | refs/heads/master | /counting_sort.py | def counting_sortw(A, get_key=lambda x: x):
# get_key is a function that takes a list element and returns its key
A2 = list(A)
max_key = max([get_key(e) for e in A2])
return counting_sort(A2, max_key, get_key)
def counting_sort(A, max_key, get_key):
# All numbers in A are in the range 0, .. , k
... | {"/radix_sort.py": ["/counting_sort.py"]} |
30,443 | rossng/clrs-sorts | refs/heads/master | /quicksort.py | import random
def quicksortw(A, randomised=False):
A2 = list(A)
return randomised_quicksort(A2, 0, len(A2)-1) if randomised else quicksort(A2, 0, len(A2)-1)
def quicksort(A, p, r):
if p < r:
# Partition the array and return the position of the pivot
q = partition(A, p, r)
# Recurs... | {"/radix_sort.py": ["/counting_sort.py"]} |
30,444 | rossng/clrs-sorts | refs/heads/master | /radix_sort.py | from counting_sort import counting_sort
def string_radix_sortw(A):
A2 = list(A)
d = len(A2[0])
return string_radix_sort(A2, d)
def string_radix_sort(A, d):
"""Perform a radix sort on a list A of uppercase strings of length d"""
for i in reversed(range(0, d)):
A = counting_sort(A, 26, lambd... | {"/radix_sort.py": ["/counting_sort.py"]} |
30,445 | rossng/clrs-sorts | refs/heads/master | /bucket_sort.py | import math
import itertools
def bucket_sortw(A):
A2 = list(A)
return bucket_sort(A2)
def bucket_sort(A):
"""Sorts a list of numbers in the range [0,1)"""
n = len(A)
B = [[] for x in range(0,n)]
for i in range(0,n):
B[math.floor(n*A[i])].insert(0, A[i])
for b in B:
b.sort()... | {"/radix_sort.py": ["/counting_sort.py"]} |
30,446 | rossng/clrs-sorts | refs/heads/master | /insertion_sort.py | def insertion_sortw(A):
A2 = list(A)
return insertion_sort(A2)
def insertion_sort(A):
for j in range(1, len(A)):
# Get the next unsorted element
key = A[j]
i = j-1
# Try each position in the sorted section, from high to low
while i >= 0 and A[i] > key:
# ... | {"/radix_sort.py": ["/counting_sort.py"]} |
30,448 | xosmig/tlcp | refs/heads/main | /tlcp.py | #!/usr/bin/env python3
import argparse
import os
import sys
import glob
import shutil
import antlr4
from typing import List
from antlrgenerated.tlcpLexer import tlcpLexer
from antlrgenerated.tlcpParser import tlcpParser
from visitor import TlcpVisitor
EXTENSION = '.meta.cfg'
GENERATED_MODELS_DIR = 'tlcp_models'
ANTL... | {"/tlcp.py": ["/visitor.py"]} |
30,449 | xosmig/tlcp | refs/heads/main | /visitor.py | from antlrgenerated.tlcpParser import tlcpParser
from antlrgenerated.tlcpVisitor import tlcpVisitor
import antlr4
from typing import Optional, List
from functools import reduce
import os
class Config:
def __init__(self, name: str, path: str, text: str):
self.name = name
self.text = text
se... | {"/tlcp.py": ["/visitor.py"]} |
30,450 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_SiteScraperFactory.py | from bs4 import BeautifulSoup as bs
import requests
from classes.class_TutSiteScraper import TutSiteScraper
from classes.class_TvrSiteScraper import TvrSiteScraper
from classes.class_NewsruSiteScraper import NewsruSiteScraper
from classes.class_RiaSiteScraper import RiaSiteScraper
from classes.class_Article impor... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,451 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_NewsruSiteScraper.py | from bs4 import BeautifulSoup as bs
import requests
from classes.class_SiteScraper import SiteScraper
class NewsruSiteScraper(SiteScraper):
def __init__(self, link):
self.site_link = link
self.name = "Newsru"
def scraper(self):
html = requests.get(self.site_link)
s... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,452 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_TutSiteScraper.py | from bs4 import BeautifulSoup as bs
import requests
from classes.class_SiteScraper import SiteScraper
class TutSiteScraper(SiteScraper):
def __init__(self, link):
self.site_link = link
self.name = "Tut"
def scraper(self):
html = requests.get(self.site_link)
soup = ... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,453 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_SiteScraper.py | from abc import ABC, abstractmethod
class SiteScraper(ABC):
@abstractmethod
def __init__(self, link):
pass
@abstractmethod
def scraper(self):
pass | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,454 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_RiaSiteScraper.py | from bs4 import BeautifulSoup as bs
import requests
import lxml
from classes.class_SiteScraper import SiteScraper
class RiaSiteScraper(SiteScraper):
def __init__(self, link):
self.site_link = link
self.name = "Ria"
def scraper(self):
html = requests.get(self.site_link)
... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,455 | LenetsEgor/Projects_Python | refs/heads/master | /NewsScraper.py | from flask import Flask, jsonify
from classes.class_SiteScraperFactory import SiteScraperFactory
app = Flask(__name__)
@app.route("/news")
def get_all_articles():
newsscraper = SiteScraperFactory()
newsscraper.scrap_sites()
articles = []
for element in newsscraper.all_articles:
ar... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,456 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_TvrSiteScraper.py | from bs4 import BeautifulSoup as bs
import requests
from classes.class_SiteScraper import SiteScraper
class TvrSiteScraper(SiteScraper):
def __init__(self, link):
self.site_link = link
self.name = "Tvr"
def scraper(self):
self.title = []
self.link = []
sel... | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,457 | LenetsEgor/Projects_Python | refs/heads/master | /classes/class_Article.py | class Article:
def __init__(self, name, title, link, text):
self.name = name
self.title = title
self.link = link
self.text = text | {"/classes/class_SiteScraperFactory.py": ["/classes/class_TutSiteScraper.py", "/classes/class_TvrSiteScraper.py", "/classes/class_NewsruSiteScraper.py", "/classes/class_RiaSiteScraper.py", "/classes/class_Article.py"], "/classes/class_NewsruSiteScraper.py": ["/classes/class_SiteScraper.py"], "/classes/class_TutSiteScra... |
30,463 | Haifasm/Fyyur | refs/heads/master | /models.py | from app import db
class Venue(db.Model):
__tablename__ = 'Venue'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
city = db.Column(db.String(120), nullable=False)
state = db.Column(db.String(120), nullable=False)
address = db.Column(db.String(120), null... | {"/models.py": ["/app.py"], "/app.py": ["/models.py"]} |
30,464 | Haifasm/Fyyur | refs/heads/master | /app.py | #----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
import json
import dateutil.parser
from flask_babel import Babel
from flask_migrate import Migrate
import babel
from flask import Flask, render_templat... | {"/models.py": ["/app.py"], "/app.py": ["/models.py"]} |
30,465 | Haifasm/Fyyur | refs/heads/master | /migrations/versions/1b677a6dac86_.py | """empty message
Revision ID: 1b677a6dac86
Revises: 56d782f53a45
Create Date: 2020-10-05 12:14:09.802014
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '1b677a6dac86'
down_revision = '56d782f53a45'
branch_labels = None... | {"/models.py": ["/app.py"], "/app.py": ["/models.py"]} |
30,510 | WSnettverksprog/simple_ws | refs/heads/master | /ws_example.py | from simple_ws import WebSocket
class WSHandler(WebSocket):
def on_message(self, msg, client):
for client in self.clients:
if client.is_open():
client.write_message(msg)
def on_open(self, client):
print("Client connected!")
def on_close(self, client):
... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,511 | WSnettverksprog/simple_ws | refs/heads/master | /test/test_ws_frame.py | import unittest
from simple_ws import WebSocketFrame
class WebSocketFrameTestMethods(unittest.TestCase):
def test_construct_parse(self):
frame = WebSocketFrame(opcode=WebSocketFrame.TEXT, payload="Test", max_frame_size=8192)
data = frame.construct()
# Should only be 1 frame with max_frame... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,512 | WSnettverksprog/simple_ws | refs/heads/master | /simple_ws/__init__.py | from .WebSocket import *
| {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,513 | WSnettverksprog/simple_ws | refs/heads/master | /test/test_request_parser.py | import unittest
from simple_ws import RequestParser
class RequestParserTestMethods(unittest.TestCase):
def test_valid_request(self):
rp = RequestParser()
input_head = "GET / HTTP/1.1\r\n" \
"Host: localhost:8080\r\n" \
"Connection: Upgrade\r\n" \
... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,514 | WSnettverksprog/simple_ws | refs/heads/master | /simple_ws/WebSocket.py | import asyncio
import hashlib
import base64
import struct
import time
import zlib
loop = asyncio.get_event_loop()
class RequestParser:
ws_const = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
def __init__(self, req=None):
self.headers = {}
self.body = ""
if req is not None:
self... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,515 | WSnettverksprog/simple_ws | refs/heads/master | /setup.py | from distutils.core import setup
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
long_description = long_description.replace("\r","")
except (IOError, ImportError):
long_description='',
setup(
name = 'simple_ws',
packages = ['simple_ws'],
version = '0.3.0',
descriptio... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,516 | WSnettverksprog/simple_ws | refs/heads/master | /test/test_frame_reader.py | import unittest
from simple_ws import FrameReader
class FrameReaderTestMethods(unittest.TestCase):
def test_continuation_frame(self):
fr = FrameReader()
frame_1 = b'\x01\x83\x00\x00\x00\x00hei'
frame_2 = b'\x80\x83\x00\x00\x00\x00 du'
res1 = fr.read_message(frame_1)[1]
re... | {"/ws_example.py": ["/simple_ws/__init__.py"], "/test/test_ws_frame.py": ["/simple_ws/__init__.py"], "/simple_ws/__init__.py": ["/simple_ws/WebSocket.py"], "/test/test_request_parser.py": ["/simple_ws/__init__.py"], "/test/test_frame_reader.py": ["/simple_ws/__init__.py"]} |
30,519 | justhinkdp/zhxg_qg | refs/heads/master | /LGB_KEY_ZQJ_3_1.py | # encoding:utf-8
# 训练分类器.
import lightgbm as lgb
import numpy as np
import vsm
path = './'
def lgb_key_train():
clabel =1
data = vsm.vsmbuild(clabel)
np.random.shuffle(data) # 打乱数据顺序
print('data', data.shape)
params = {
'task': 'train',
'boosting_type': 'gbdt',
... | {"/LGB_KEY_ZQJ_3_1.py": ["/vsm.py"]} |
30,520 | justhinkdp/zhxg_qg | refs/heads/master | /vsm.py | # encoding:utf-8
import numpy as np
import jieba
# vsm.py负责构建文本向量,用来训练模型/进行预测
def vsmbuild(clabel):
# 处理第一层3个场景+others 场景的训练数据,转化为向量形式
# word2id中key为关键词,value为关键词在word2id中的编号/位置(从0开始)
# word2id_cat中key为关键词,value为关键词对应的场景
if clabel == 1:
word2id = {}
word2id_cat = {}
path = './d... | {"/LGB_KEY_ZQJ_3_1.py": ["/vsm.py"]} |
30,521 | justhinkdp/zhxg_qg | refs/heads/master | /predict_ZQJ_3_1.py | # -*- coding:utf-8 -*-
import lightgbm as lgb
import jieba
import re
import numpy as np
path = './data/'
# sentence是词典,存储要预测是语句
def key_cv(sentence):
word2id={}
word2id_cat={}
word2id_cat_m = {}
# mergerate=0.05
# tfidf keyword
for line in open(path+"keywords_single_250.txt", encoding='UTF-8... | {"/LGB_KEY_ZQJ_3_1.py": ["/vsm.py"]} |
30,533 | fatwookie/netcrawl | refs/heads/master | /netcrawl.py | #!/usr/bin/env python3
#
"""
This script contacts a network device via SNMP and tries to download
the contents of the MAC address table. This should normally be available
at the OID 1.3.6.1.2.1.17.4.3.1 from the BRIDGE-MIB, using object
dot1dTpFdbEntry.
See also: http://www.cisco.com/en/US/tech/tk648/tk362/technologi... | {"/netcrawl.py": ["/ncrawl.py"]} |
30,534 | fatwookie/netcrawl | refs/heads/master | /ncrawl.py | import pyasn1
try:
from config import *
except:
print("Import error: config.py. Make sure to view README")
exit(2)
try:
import ipaddress
except:
print("Import error: ipaddress. Make sure to run pip3 install -r requirements.txt")
exit(2)
try:
from pysnmp.hlapi import *
except:
print("I... | {"/netcrawl.py": ["/ncrawl.py"]} |
30,566 | phenal-projects/biokg_rgcn | refs/heads/master | /training_utils.py | from itertools import product
import torch
from torch import nn
from torch.nn import functional as F
from torch_sparse import SparseTensor
from sklearn.metrics import roc_auc_score, average_precision_score
def drop_edges(mat, p=0.3):
mask = torch.rand((mat.storage.row().shape[0],)) > p
matr = SparseTensor(
... | {"/run.py": ["/models.py", "/data.py", "/training_utils.py"]} |
30,567 | phenal-projects/biokg_rgcn | refs/heads/master | /models.py | import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric import nn as gnn
from torch_geometric.nn.inits import glorot_orthogonal
class RGCNStack(nn.Module):
def __init__(
self,
initial_size,
output_size,
middle_size_1,
middle_size_2,
... | {"/run.py": ["/models.py", "/data.py", "/training_utils.py"]} |
30,568 | phenal-projects/biokg_rgcn | refs/heads/master | /run.py | import argparse
from collections import defaultdict
from itertools import chain
import mlflow
import numpy as np
import pandas as pd
import torch
import torch.optim as opt
from ogb.linkproppred import Evaluator
from sklearn.metrics import average_precision_score, roc_auc_score
from torch import nn
from torch_geometric... | {"/run.py": ["/models.py", "/data.py", "/training_utils.py"]} |
30,569 | phenal-projects/biokg_rgcn | refs/heads/master | /data.py | from ogb.linkproppred.dataset_pyg import PygLinkPropPredDataset
import numpy as np
import torch
def load_biokg():
biokg = PygLinkPropPredDataset(name="ogbl-biokg", root="./datasets")
split_edge = biokg.get_edge_split()
train_edge, valid_edge, test_edge = (
split_edge["train"],
split_edge["... | {"/run.py": ["/models.py", "/data.py", "/training_utils.py"]} |
30,599 | Rookiee/Research_Related | refs/heads/master | /test.py | # coding: utf-8
'''
导入本目录下的hos.py
'''
import hos
import cv2
pathName = 'C:/Users/Administrator/Desktop/result1.bmp'
imgGray = cv2.imread(pathName,0)
imgGaussian = hos.GaussianFilter(imgGray,(3,3),1)
| {"/test.py": ["/hos.py"]} |
30,600 | Rookiee/Research_Related | refs/heads/master | /reName.py | # coding: utf-8
"""
Author: Rookiee
Date: 2016-4-4
Location: Donghua University
Destription: Rename file names in the folder.
The new file names will be 0001.bmp, 0002.bmp...
The user need to provide two paramters:
absolute path: d:/test
extension name: txt
"""
import os
# Input the absolute path of... | {"/test.py": ["/hos.py"]} |
30,601 | Rookiee/Research_Related | refs/heads/master | /thresh.py | # coding: utf-8
# 渐进显示, 打断时输出阈值
import numpy as np
import cv2
img = cv2.imread("D:/Pics/boldt.jpg",0)
cv2.namedWindow("Test")
for i in np.arange(256):
ret, binary = cv2.threshold(img,i,255, cv2.THRESH_BINARY);
cv2.imshow("Test", binary);
if cv2.waitKey(30)==ord('q'):
print i
break
cv2.destroyAllWindows()... | {"/test.py": ["/hos.py"]} |
30,602 | Rookiee/Research_Related | refs/heads/master | /reconstruct.py | # coding: utf-8
import cv2
import numpy as np
size = 3
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (size, size))
def myerosin(img):
erodeImg = cv2.erode(img, kernel, iterations = 1)
img = cv2.max(erodeImg, img)
return erodeImg
def mydilation(img):
# kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3,3... | {"/test.py": ["/hos.py"]} |
30,603 | Rookiee/Research_Related | refs/heads/master | /differenceBetweenTwoFrames.py | import cv2
import numpy as np
img1 = cv2.imread("C:/Users/Administrator/Desktop/0027.BMP")
img2 = cv2.imread("C:/Users/Administrator/Desktop/result2.BMP")
img1Gray = cv2.imread("C:/Users/Administrator/Desktop/0027.BMP", 0)
img2Gray = cv2.imread("C:/Users/Administrator/Desktop/result2.BMP",0)
imgGray = np.ones(img... | {"/test.py": ["/hos.py"]} |
30,604 | Rookiee/Research_Related | refs/heads/master | /hos.py | # coding: utf-8
'''
按照文章方法计算四阶矩,函数为get4moments
'''
import cv2
import numpy as np
# Img: 待处理的Img; N:size of kernel
def get4moments(Img, N):
# 使用均值滤波对原始图像处理
img1 = cv2.blur(Img, (N, N))
# 因为要计算四阶矩,对一个随机变量X,四阶矩即 E(X^4)
# 随机变量X 是原始图像 和 模糊后图像 的差值
diff = (Img - img1) ** 4
# 再对X进行均值滤波
img2 = cv... | {"/test.py": ["/hos.py"]} |
30,605 | Rookiee/Research_Related | refs/heads/master | /afterHOS.py |
# import cv2
# import numpy as np
# img = cv2.imread("C:/Users/Administrator/Desktop/0100.BMP")
# cv2.imshow("Original", img)
# rows, cols, depth = img.shape
# M = cv2.getRotationMatrix2D((cols/2, rows/2),30, 1)
# dst = cv2.warpAffine(img, M, (cols, rows))
# cv2.imshow("Result", dst)
# print "Original: ", img.shape,... | {"/test.py": ["/hos.py"]} |
30,626 | nickcxm/quote-site | refs/heads/master | /quotes/quote/urls.py | from django.conf.urls import url
from . import views
app_name='quote'
urlpatterns=[
url(r'^$',views.IndexView.as_view(),name='index'),
url(r'^add/$',views.add,name='add'),
url(r'^tag/(?P<pk>[0-9]+)/$',views.TagView.as_view(),name='tag'),
url(r'^search/$',views.search,name='search')
] | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,627 | nickcxm/quote-site | refs/heads/master | /quotes/quote/templatetags/quote_tags.py | from ..models import Tag
from django import template
from django.db.models.aggregates import Count
register=template.Library()
@register.simple_tag
def get_most_tags():
return Tag.objects.annotate(num_quote=Count('quote')) | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,628 | nickcxm/quote-site | refs/heads/master | /quotes/quote/admin.py | from django.contrib import admin
from .models import Tag,Quote
# Register your models here.
class TagAdmin(admin.ModelAdmin):
list_display = ['name']
class QuoteAdmin(admin.ModelAdmin):
list_display = ['text','author','created_time']
admin.site.register(Tag,TagAdmin)
admin.site.register(Quote,QuoteAdmin)
| {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,629 | nickcxm/quote-site | refs/heads/master | /quotes/quote/models.py | from django.db import models
# Create your models here.
class Tag(models.Model):
name=models.CharField(max_length=20)
def __str__(self):
return self.name
class Quote(models.Model):
text=models.TextField()
author=models.CharField(max_length=20)
created_time=models.DateTimeField(auto_now_a... | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,630 | nickcxm/quote-site | refs/heads/master | /quotes/quote/migrations/0002_auto_20180203_1258.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-02-03 04:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quote', '0001_initial'),
]
operations = [
migrations.RenameField(
model... | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,631 | nickcxm/quote-site | refs/heads/master | /quotes/quote/forms.py | from django import forms
from .models import Tag,Quote
class QuoteForm(forms.ModelForm):
# tags=forms.MultipleChoiceField(Tag.objects.all())
class Meta:
model=Quote
fields=['text','author','tags'] | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,632 | nickcxm/quote-site | refs/heads/master | /quotes/quote/views.py | from django.shortcuts import render,get_object_or_404,redirect
from django.views.generic import ListView
from .models import Tag,Quote
from django.db.models import Q
from .forms import QuoteForm
# Create your views here.
class IndexView(ListView):
model = Quote
template_name = 'index.html'
context_object_na... | {"/quotes/quote/templatetags/quote_tags.py": ["/quotes/quote/models.py"], "/quotes/quote/admin.py": ["/quotes/quote/models.py"], "/quotes/quote/forms.py": ["/quotes/quote/models.py"], "/quotes/quote/views.py": ["/quotes/quote/models.py", "/quotes/quote/forms.py"]} |
30,640 | BrightTux/trajClassifier | refs/heads/master | /generateList.py | f= open("test.csv","w+")
startNum = 1
endNum = 44
for i in range(startNum, endNum+1):
f.write("%d;NoActivity\r\n" % (i))
i += 1
startNum = 45
endNum = 97
for i in range(startNum, endNum+1):
f.write("%d;Traj1\r\n" % (i))
i += 1
startNum = 98
endNum = 117
for i in range(startNum, endNum+1):
f.... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,641 | BrightTux/trajClassifier | refs/heads/master | /hello.py | # hello.py
import numpy as np
from numpy import array
np.set_printoptions(precision=2)
def rescale_list(input_list, size):
"""Given a list and a size, return a rescaled/samples list. For example,
if we want a list of size 5 and we have a list of size 25, return a new
list of size five which is every 5th... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,642 | BrightTux/trajClassifier | refs/heads/master | /feature_extract.py | """
This script generates extracted features for each video, which other
models make use of.
You can change you sequence length and limit to a set number of classes
below.
class_limit is an integer that denotes the first N classes you want to
extract features from. This is useful is you don't want to wait to
extract al... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,643 | BrightTux/trajClassifier | refs/heads/master | /processor.py | """
Process an image that we can pass to our networks.
"""
from keras.preprocessing.image import img_to_array, load_img
import numpy as np
def process_image(image, target_shape, add_noise):
"""Given an image, process it and return the array."""
# Load the image.
h, w, _ = target_shape
bool_addnoise = ... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,644 | BrightTux/trajClassifier | refs/heads/master | /train.py | # https://github.com/farquasar1/ConvLSTM.git
import matplotlib
matplotlib.use('agg')
import os
from os import walk
import time
os.environ['KERAS_BACKEND'] = 'tensorflow'
from keras import backend as K
from keras.callbacks import TensorBoard, ModelCheckpoint, EarlyStopping, CSVLogger
K.set_image_dim_ordering('tf')
#fr... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,645 | BrightTux/trajClassifier | refs/heads/master | /randomize.py | # % randomly order test/train list
f= open("test_random.csv","w+")
import random
with open('test.csv') as f_input:
lines = f_input.read().splitlines()
random.shuffle(lines)
# print ('\n'.join(lines))
f.write('\n'.join(lines))
| {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
30,646 | BrightTux/trajClassifier | refs/heads/master | /dataclass.py | import numpy as np
import keras
from processor import process_image
import glob
import os
import csv
from keras.preprocessing.image import img_to_array, load_img
class DataGenerator(keras.utils.Sequence):
'Generates data for Keras'
def __init__(self, list_IDs, labels, shape_h, shape_w, seq_length, batch_size=... | {"/feature_extract.py": ["/dataclass.py"], "/dataclass.py": ["/processor.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.