id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8078241
import torch import torch.nn as nn import torch.nn.functional as F from .pointnet import PointNet from .pooling import Pooling from .. ops.transform_functions import PCRNetTransform as transform class iPCRNet(nn.Module): def __init__(self, feature_model=PointNet(), droput=0.0, pooling='max'): super().__init__() ...
StarcoderdataPython
1671408
import os import time import datetime import tweepy def get_authorized_api(): consumer_key = os.getenv('GB_CONSUMER_KEY') consumer_secret = os.getenv('GB_CONSUMER_SECRET') access_token = os.getenv('GB_ACCESS_TOKEN') access_token_secret = os.getenv('GB_TOKEN_SECRET') auth = tweepy.OAuthHandler(co...
StarcoderdataPython
5003026
""" Definition of ParentTreeNode: class ParentTreeNode: def __init__(self, val): self.val = val self.parent, self.left, self.right = None, None, None """ class Solution: """ @param: root: The root of the tree @param: A: node in the tree @param: B: node in the tree @return: The ...
StarcoderdataPython
11264560
#!/usr/bin/env python # -*- coding: utf-8 -*- # <NAME>, 2018 from flask import Blueprint, render_template, request from admin.database import Database from utils.basic_auth import requires_auth from utils.responses import Success, Error blueprint = Blueprint('researcher_tokens', __name__) database = Database() @bl...
StarcoderdataPython
1794761
import os import re import ai_info import global_config import collections import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import linear_model from sklearn.metrics import mean_squared_error from read_data.utils import * from read_data.perf import * from analyze_interferen...
StarcoderdataPython
1965623
#!/bin/python """ Copyright 2016 <NAME> 1. Bubble Sort O(n^2) """ def sort_bubblesort(my_list): for pos_upper in xrange(len(my_list)-1,0,-1): for i in xrange(pos_upper): if my_list[i] > my_list[i+1]: my_list[i], my_list[i+1] = my_list[i+1], my_list[i] print "...
StarcoderdataPython
1878644
<filename>python-backend/app/api/variances/resources/variance_resource.py from flask_restplus import Resource from flask import request from sqlalchemy_filters import apply_pagination, apply_filters from app.extensions import api from ..models.variance import Variance from ..models.variance_application_status_code im...
StarcoderdataPython
307293
<reponame>RealGeeks/django-cache-purge-hooks import mock from sampleproject.sample.models import TestModel from django.test.utils import override_settings import pytest @pytest.mark.django_db @mock.patch('cache_purge_hooks.backends.varnishbackend.VarnishManager.purge') def test_purge_on_save(purge): with override...
StarcoderdataPython
11339271
from modules.motion_detector import MotionDetector class DetectMotionPipe: def __init__(self, conf): self.detector = MotionDetector(**conf) def __call__(self, data): return self.detect(data) def detect(self, data): image = data["image"] # Detect motion locations ...
StarcoderdataPython
3436795
import yaml def handle_pr_push(payload): (branch, pr_number, commit_sha, org, repo) = extract_pr_info(payload) print(yaml.dump(scaffold_workflow(repo, org, f"pr-{pr_number}", commit_sha))) def handle_master_push(payload): (commit_sha, org, repo) = extract_master_info(payload) print(yaml.dump(scaffold_workflo...
StarcoderdataPython
11379114
import time from idle_time import IdleMonitor import json from datetime import datetime from src import actions from pynput import keyboard from threading import Thread import subprocess import requests computer_code = "258752" pressed_keys = "" pressed = False process = {} user_automations = {} system_actions = { ...
StarcoderdataPython
4881192
# View the specified parameters of your GBM model air_model.params # Examine the performance of the trained model air_model
StarcoderdataPython
240698
<filename>app/api/__init__.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # @Time : 2019/4/18 11:03 AM # @Author : ShaHeTop-Almighty-ares # @Email : <EMAIL> # @File : __init__.py.py # @Software: PyCharm from flask import Blueprint from flask_restful import Api from .restful_demo.restful_demo import RestfulDemo...
StarcoderdataPython
381601
DEFAULT_OREMDA_VAR_DIR = "/tmp" DEFAULT_PLASMA_SOCKET_PATH = f"{DEFAULT_OREMDA_VAR_DIR}/plasma.sock" DEFAULT_DATA_DIR = "/data"
StarcoderdataPython
166227
from setuptools import setup setup( name='rfpimp', version='1.2', url='https://github.com/parrt/random-forest-importances', license='MIT', py_modules=['rfpimp'], author='<NAME>, <NAME>', author_email='<EMAIL>, <EMAIL>', install_requires=['numpy','pandas','sklearn','matplotlib'], des...
StarcoderdataPython
233634
# Copyright (c) 2011, <NAME> [see LICENSE.txt] # This software is funded in part by NIH Grant P20 RR016454. # Python 2 to 3 workarounds import sys if sys.version_info[0] == 2: _strobj = str _xrange = xrange elif sys.version_info[0] == 3: _strobj = str _xrange = range import collections import csv im...
StarcoderdataPython
1669808
#!/usr/bin/env python ''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License")...
StarcoderdataPython
6596753
import re import typing from Custom.LineNumberReader import LineNumberReader from Exceptions.Parse import YjcParseError from Token.TokenYJC import TokenYJC, IdentifierTokenYJC, NumTokenYJC, StrTokenYJC class LexerYJC: IntegerLiteral = "[0-9]+" IdentifierLiteral = "[A-Z_a-z][A-Z_a-z0-9]*|==|<=|>=|&&|\\|\\||\S...
StarcoderdataPython
1955144
<gh_stars>0 # @copyright@ # Copyright (c) 2006 - 2018 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ import stack.commands class command(stack.commands.HostArgumentProcessor, stack.commands.set.command): def verifyInterface(self,...
StarcoderdataPython
9671112
# # # Public Archive of Days Since Timers # Setuptools Configuration # # import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() os.chdir(os.path.normpath(os.path.join( os.path.abspath(__file__), os.pardir))) setup...
StarcoderdataPython
3279470
<filename>tests/unit/test_docs.py """Test for the sphinx documentation.""" import subprocess import glob import os import pytest import regex UNDOCUMENTED_FILES = ["__init__", "constants", "lib_mapper", "protocol_mapper", "variables"] SPHINX_DIRECTORIES = [ { "source_dir": "docs/source/", "build_d...
StarcoderdataPython
1620673
<reponame>pcf26536/politico-api from api.ver1.utils import error def system_unavailable(e): print('Runtime Exception: ' + e.args[0]) return error( message='System unavailable, please try again later!', code=500 )
StarcoderdataPython
90731
# -*- coding: utf-8 -*- """ Created on Thu Jan 6 08:59:23 2022 @author: <NAME> """ import operator import itertools ewns = [[0] * 360] * 360 def theta_python(theta1, theta2): ew = theta1 + 180 # ns = 180 - theta2 if theta2 > 179 else 179 - theta2 ns = -1 * (theta2 - 179) return ew, ns def python_...
StarcoderdataPython
151654
<reponame>royqh1979/programming_with_python from easygraphics.turtle import * def Fill(size, level): if level == 0: fd(size) return Fill(size / 3, level - 1) lt(90) Fill(size / 3, level - 1) for i in range(3): rt(90) Fill(size / 3, level - 1) for i in range(3): ...
StarcoderdataPython
5189750
from building import Building from material import Material class IndoorMaterial(Material, Building): """Class that stores methods for the indoor material. Mainly to calculate the material volume inside a building. """ def __init__(self, material='cinderblock'): Building.__init__(self) ...
StarcoderdataPython
6585197
<gh_stars>0 """Models used for API request and response validation.""" from pydantic import BaseModel class AuthReq(BaseModel): """The request format for the authorization API request.""" email: str password: str class AccountReq(BaseModel): """The request format for account API request.""" p...
StarcoderdataPython
8070551
<reponame>dshirle7/capstone2 import gym from gym import error, spaces, utils from gym.utils import seeding import numpy as np import random class BlackjackEnv(gym.Env): # Blackjack environment that runs on a single deck of cards metadata = {'render.modes': ['human']} def __init__(self): self.action_...
StarcoderdataPython
29490
<gh_stars>1-10 import sys input = sys.stdin.readline n = int(input()) if n < 2: print(n) exit(0) d = [0] * (n+1) d[1] = 1 d[2] = 3 for i in range(n+1): if i < 3: continue d[i] = (d[i-1] % 10007 + (d[i-2]*2) % 10007) % 10007 print(d[n])
StarcoderdataPython
3565236
<reponame>worldbank/moz-tech-reserva-de-nome from django.apps import AppConfig class CoreConfig(AppConfig): name = "reserva.core" verbose_name = "Reserva de nome"
StarcoderdataPython
1842669
<reponame>rtibbles/python-delta-crdts import pytest from delta_crdt import LWWReg from .helpers import transmit @pytest.fixture def lwwreg(): return LWWReg("test id") def test_can_create(lwwreg): pass def test_starts_empty(lwwreg): assert lwwreg == None # noqa def test_can_write_values(lwwreg): ...
StarcoderdataPython
336302
<filename>core/rules.py #!/usr/bin/python2.4 # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
StarcoderdataPython
3496969
<filename>tests/utils/test_serialize.py import tempfile import pytest from myia import xtype from myia.abstract import ANYTHING from myia.ir import Constant, Graph, isomorphic from myia.prim.ops import scalar_add, switch from myia.utils import dump, load from ..common import to_abstract_test parametrize = pytest.ma...
StarcoderdataPython
8022595
<gh_stars>0 from fastapi.security import OAuth2PasswordBearer from passlib.context import CryptContext from jose import JWTError, jwt # to get a string like this run: # openssl rand -hex 32 SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES ...
StarcoderdataPython
8192358
import re import numpy as np import pandas as pd from nltk.corpus import stopwords from nltk.stem import PorterStemmer from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import cross_val_score from sklearn.naive_bayes import MultinomialNB def preProc(tweet, stemmer): tweet =...
StarcoderdataPython
9689252
<reponame>txwhhny/vtk #!/usr/bin/env python # we need to use composite data pipeline with multiblock datasets alg = vtk.vtkAlgorithm() pip = vtk.vtkCompositeDataPipeline() alg.SetDefaultExecutivePrototype(pip) del pip # Create the RenderWindow, Renderer and both Actors # Ren1 = vtk.vtkRenderer() Ren1.SetBackground(0.3...
StarcoderdataPython
9796191
import games as g level = g.Game(700, 700, 100, 100) level.addwall(600, 650, 150, 750) level.addwall(450, 500, 0, 650) level.addwall(300, 350, 150, 750) level.addwall(150, 200, 0, 650)
StarcoderdataPython
5143059
<gh_stars>0 from vizdoommaze.envs.vizdoomenv import VizdoomEnv class VizdoomMazeFour6(VizdoomEnv): def __init__(self): super(VizdoomMazeFour6, self).__init__(79)
StarcoderdataPython
3570978
#!/usr/bin/python # $Id: ircView.py,v 1.4 2001/10/09 22:19:57 ivo Exp $ import sys from string import strip from threading import Thread from time import sleep from view import guiMessage from genericView import genericView from msgSupport import msgSupport from serverView import serverView from util.debug import d...
StarcoderdataPython
4865739
# Created by Kelvin_Clark on 3/10/22, 5:34 PM
StarcoderdataPython
1653691
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'cal2.ui' # # Created by: PyQt5 UI code generator 5.15.0 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCor...
StarcoderdataPython
11270728
<gh_stars>0 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
StarcoderdataPython
223813
<reponame>gauravaror/pydano import requests from collections import Counter import argparse import tqdm import json import os import logging import random import functools import pandas as pd from pydano.blockfrost.top_holder import TopHolders parser = argparse.ArgumentParser() parser.add_argument( "--allow_mul...
StarcoderdataPython
1609581
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # # You may obtain a copy of the License at: ...
StarcoderdataPython
1999479
from setuptools import setup from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='zarenacord.py', author='Bravestone', version='2.0.1', url='https://github.com/Za...
StarcoderdataPython
8195074
"""Modules that handles how the post shall be sent according to the chat (adming group or channel)""" from random import choice from telegram import Message, Bot, InlineKeyboardMarkup from modules.data.data_reader import config_map from modules.data.meme_data import MemeData from modules.utils.keyboard_util import get_...
StarcoderdataPython
4983017
# Constantes para os datasets usdos CLEAN_VEHICLES_DATASET = "../datasets/clean_vehicles.csv" CLEAN_VEHICLES_2_DATASET = "../datasets/clean_vehicles_2.csv" # Pontos limites em coordenadas geograficas dos EUA TOP_LEFT_PT = (52.920556, -172.437778) TOP_RIGHT_PT = (71.388889, -156.479167) BOTTOM_RIGHT_PT = (44.816667, -6...
StarcoderdataPython
11362704
<gh_stars>100-1000 from .earnings import EarningsCalendarLoader from .buyback_auth import ( CashBuybackAuthorizationsLoader, ShareBuybackAuthorizationsLoader ) from .dividends import ( DividendsByAnnouncementDateLoader, DividendsByExDateLoader, DividendsByPayDateLoader, ) from .equity_pricing_loader...
StarcoderdataPython
11368488
import numpy import pyaudio def main(): # nothing to see yet here
StarcoderdataPython
3519000
<filename>pyesmini/pyesminiRM.py from ctypes import * import ctypes from .shared import * # /home/wave/repositories/QtEsmini/pyesmini/pyesmini/esminiRMLib.hpp: 34 class PositionData(Structure): _fields_ = [ ('x', c_float), ('y', c_float), ('z', c_float), ('h', c_float), ('p...
StarcoderdataPython
1620585
# coding=utf-8 from setuptools import setup from cms_support.utils.constants import Constants # long_description=open('README.md').read(), # https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/ setup( name=Constants.PACKAGE_NAME, version=Constants.VERSION, author=C...
StarcoderdataPython
381330
"""File that FLASK_APP should be set to. This allows the usage of make run (for running the dev server), and flask shell (for debugging the app)""" from app import app, db, routes # pylint:disable=unused-import from app.models import Users, Polls, Options db.create_all() @app.shell_context_processor def make_shell_...
StarcoderdataPython
8079717
# -*- coding: utf-8 -*- """ Created on Mon Sep 3 15:59:51 2018 请实现一个函数,将一个字符串中的每个空格替换成“%20”。 例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 @author: fengxue """ def Replace_blank(string): new_string='' for i in string: if i!=' ': new_string+=i elif i==' ': ...
StarcoderdataPython
3361062
<filename>elite/loader/maddavo/__init__.py # -*- coding: UTF8 from elite.loader.maddavo import system from elite.loader.maddavo import station from elite.loader.maddavo import prices from elite.loader.maddavo import items from datetime import datetime, timedelta def updateAll(mydb): lastUpdateTime = my...
StarcoderdataPython
6637073
<reponame>rodrigo-moliveira/PositioningSolver<gh_stars>0 from ..basics.DataType import DataTypeFactory """ Utility maps and dicts to deal with the constellations and services. -> Available constellations: Galileo and GPS """ AvailableConstellations = {"GPS", "GAL", "UNKNOWN"} # Rinex format GPSAvailableServices = {'...
StarcoderdataPython
4863250
class SelfAttention(nn.Module): """Multi-head self attention layer Args: k (int): Size of attention embeddings heads (int): Number of attention heads Attributes: to_keys: Transforms input to k x k*heads key vectors to_queries: Transforms input to k x k*heads query vectors to_values: Transfor...
StarcoderdataPython
274234
#!/usr/bin/env python3 """Convert hector outputstreams to pickled python objects This program was run on the sample_outputstream*.csv files distributed with hector to produce the *.dat files in the data directory of this package. """ import pandas as pd import pickle for rcp in ['rcp26', 'rcp45', 'rcp60', 'rcp85']...
StarcoderdataPython
5174825
<reponame>Matsui54/defx.nvim # ============================================================================ # FILE: space.py # AUTHOR: <NAME> <<EMAIL>.Matsu at g<EMAIL>> # License: MIT license # ============================================================================ from pynvim import Nvim import typing from de...
StarcoderdataPython
88600
<filename>opponents/behaviour_parser.py from __future__ import unicode_literals import re import sys from ordered_xml import OrderedXMLElement if sys.version_info[0] < 3: from io import open class ParseError(Exception): """Represents an error encountered during parsing.""" def __init__(self, msg, par...
StarcoderdataPython
363353
<reponame>xe1gyq/EekMex #!/usr/bin/python import logging from random import randint try: #import pyupm_bmpx8x as upmBmpx8x import Adafruit_BMP.BMP085 as BMP085 except ImportError: pass def emPressureGet(mode=None): if mode is None: #pressure = upmBmpx8x.BMPX8X(1, upmBmpx8x.ADDR); #pre...
StarcoderdataPython
5179260
import uuid class Request: 'This is the main object that stores information about somones request' def __init__(self, kind, value, user, date): self.kind = kind # options: "search, url, IPFS hash, git URL self.value = value # the value associated with the type self.user = user # The user...
StarcoderdataPython
3598457
<reponame>sokil/VotingEngine from app import db from sqlalchemy import Column, String, Integer, ForeignKey class Vote(db.Model): __tablename__ = 'votes' id = Column(Integer, primary_key=True) voting_id = Column(Integer, ForeignKey('votings.id')) voting_variant_id = Column(Integer, ForeignKey('voting_...
StarcoderdataPython
9684522
<gh_stars>1-10 from unittest import TestCase from pathlib import Path from defx.util import deft_to_jsonl_converter class DeftToJsonlConverterTest(TestCase): """Tests the conversion script from deft format into jsonl""" @staticmethod def test_chapter_detection(): true_example_1 = {'tokens': ['5'...
StarcoderdataPython
1991635
<gh_stars>0 import click import paho.mqtt.client as mqtt @click.command() @click.option('--name', prompt='enter your name', help='enter user name') @click.option('--age', prompt='enter your age', help='enter user age') def init(name, age): client = mqtt.Client() print(client) print(name) print(age)...
StarcoderdataPython
4986921
<gh_stars>0 class HeadQuartersOffice(): '''Defines the HQ class''' __rpio = None __name = None __title = None __data = None __dataframe = None @property def rpio( self ): if self.__rpio is not None: return self.__rpio @rpio.setter def rpio( self, code ): ...
StarcoderdataPython
3308693
<gh_stars>0 import os from torchaudio.datasets.utils import ( download_url, extract_archive ) import shutil FOLDER_IN_ARCHIVE = "SpeechCommands" URL = "speech_commands_v0.02" _CHECKSUMS_SC = { "https://storage.googleapis.com/download.tensorflow.org/data/speech_commands_v0.01.tar.gz": "3cd23799cb2bbdec5...
StarcoderdataPython
9749466
''' Faça um programa que simula o lançamento de dois dados, d1 e d2, n vezes, e tem como saída o número de cada dado e a relação entre eles (>,<,=) de cada lançamento. ''' # não entendi nada, portanto não vou fazer
StarcoderdataPython
6589987
""" This script will test the submodules used by the scattering module""" import torch import os import numpy as np import pytest from kymatio import HarmonicScattering3D from kymatio.scattering3d.utils import generate_weighted_sum_of_gaussians backends = [] try: if torch.cuda.is_available(): from skcuda...
StarcoderdataPython
1679685
import traceback from pycompss.api.task import task from pycompss.api.constraint import constraint from pycompss.api.multinode import multinode from pycompss.api.parameter import FILE_IN, FILE_OUT from biobb_common.tools import file_utils as fu from biobb_pmx.pmx import mutate import os import sys @constraint(computi...
StarcoderdataPython
82496
<filename>Pacote Dowload/pythonProject/aula017.py #num=[2,5,9,1] #num[2]=3 #na posiçao 2 vai mudar de 9 para virar 3 #num.append(7) #estou adicionando o valor 7 #num.sort(reverse=True) #ordem reversa #num.insert(2,0) #inseri um valor e reordena automaticamente o resto, ...
StarcoderdataPython
3525832
import datetime from tornado.web import RequestHandler from tornado import gen from bson.objectid import ObjectId class Handler(RequestHandler): @gen.coroutine def get(self, _id): """比赛介绍""" try: contest = yield self._find_contest(_id) if contest["password"]: ...
StarcoderdataPython
357958
import discord from app.classes.bot import Bot async def get_guild_leaderboard(bot: Bot, guild: discord.Guild) -> dict: leaderboard = {} top_users = await bot.db.fetch( """SELECT * FROM members WHERE guild_id=$1 AND xp > 0 ORDER BY xp DESC LIMIT 200""", guild.i...
StarcoderdataPython
11244371
from collections import defaultdict def foodmenu(order, menu): res = defaultdict(int) queue = [menu[order]] while queue: menu_list = queue.pop(0) while menu_list: item = menu_list.pop(0) # item.values()-- [1] or ["meat":...] if type(item.values()[0]) == type(1): res[item.keys()[0]] += item.values(...
StarcoderdataPython
11394730
<reponame>xmyqsh/jittor import setuptools from setuptools import setup, find_packages import os path = os.path.dirname(__file__) with open(path + "/README.src.md", "r") as fh: long_description = fh.read() setuptools.setup( name='jittor', version='1.0.0', # scripts=[], author="<NAME>", autho...
StarcoderdataPython
4876863
# Copied from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65938 # Full credit to <NAME> for the basic implementation of the original Focal Loss # paper: https://arxiv.org/abs/1708.02002 import torch import torch.nn as nn from torch.nn import functional as F class FocalLoss(nn.Module): ''...
StarcoderdataPython
6660166
#!/usr/bin/env python ############################################################################## # # diffpy.Structure by DANSE Diffraction group # <NAME> # (c) 2007 trustees of the Michigan State University. # All rights reserved. # # File coded by: <NAME> #...
StarcoderdataPython
181200
from tuiuiu.tuiuiusearch.views.frontend import search # noqa
StarcoderdataPython
6484541
<reponame>alanStocco/leetcode-solutions class Solution(object): def dfs(self,i,j,matrix,explored,prev): rows, cols = len(matrix),len(matrix[0]) if i < 0 or i >= rows or j < 0 or j >= cols or (i,j) in explored or matrix[i][j] < prev: return explored.add((i,j)) self.dfs(i-1...
StarcoderdataPython
4912377
import numpy as np import rospy import time from openai_ros import robot_gazebo_env from std_msgs.msg import Float64 from sensor_msgs.msg import JointState from sensor_msgs.msg import Image from sensor_msgs.msg import LaserScan from sensor_msgs.msg import PointCloud2 from nav_msgs.msg import Odometry from geometry_msg...
StarcoderdataPython
5012799
<reponame>tjensen/fsuipc-airspaces<filename>setup.py import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="fsuipc-airspaces", version="1.0.0", author="<NAME>", author_email="<EMAIL>", description="FSUIPC client for reporting flight simulato...
StarcoderdataPython
8099226
<reponame>CaioCavalcanti/hackerhank #!/bin/python3 """ A linked list is said to contain a cycle if any node is visited more than once while traversing the list. Complete the function provided for you in your editor. It has one parameter: a pointer to a Node object named head that points to the head of a linked list. Yo...
StarcoderdataPython
267102
<gh_stars>0 import torch import torch.nn.functional as F from random import shuffle import numpy as np class CosineClusters(): def __init__(self, num_clusters=100, Euclidean=False): self.clusters = [] # 储存各个集群 self.item_cluster = {} # 储存每个样本所属集群 self.Euclidean = Euclidean # 初...
StarcoderdataPython
368314
<reponame>lemonviv/SplitNNDemo<gh_stars>0 import matplotlib.pyplot as plt def plot_train(train_losses, train_accuracies, test_accuracies): """ Args :param train_losses: historical train loss for each epoch :param train_accuracies: historical train accuracy for each epoch :param test_accuracies: hi...
StarcoderdataPython
1774077
<reponame>ArakniD/InvenTree # Generated by Django 3.0.7 on 2020-08-20 04:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('company', '0023_auto_20200808_0715'), ('stock', '0048_auto_20200807_2344'), ] o...
StarcoderdataPython
6696727
<gh_stars>10-100 """Utilities for RGB images.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np import scipy.misc import scipy.signal import PIL.Image def transform(data, translation, theta): """Create a new image by tra...
StarcoderdataPython
6432118
<reponame>Michaeljurado24/nengo """Helper functions for constructing nengo models that implement actions.""" import numpy as np import nengo def convolution(module, target_name, effect, n_neurons_cconv, synapse): """Implement an action_objects.Convolution. Parameters ---------- module : spa.Module ...
StarcoderdataPython
6627452
# -*- coding: utf-8 -*- __author__ = '<NAME>' __copyright__ = 'MacSeNet' import torch import torch.nn as nn from torch.autograd import Variable class DFFN(nn.Module): def __init__(self, N, l_dim): """ Constructing blocks for a two-layer FFN. Args : N : (int) Original dim...
StarcoderdataPython
8083491
"""Helper functions to use across tests.""" from django.http import JsonResponse def mock_check_auth_success(request, needs_auth, func): """Mocks `helpers.check_auth`, for success.""" return func(request) def mock_render_error_response(error_str): """Mocks `helpers.render_error_response`, for failure.""...
StarcoderdataPython
6605800
<reponame>asergeenko/get_some_food # Generated by Django 3.1 on 2021-11-30 22:10 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
StarcoderdataPython
1781085
<filename>accelerator/shell/job.py ############################################################################ # # # Copyright (c) 2020 <NAME> # # ...
StarcoderdataPython
5175798
# -*- coding: utf-8 -*- import scrapy from locations.hours import OpeningHours from locations.items import GeojsonPointItem class STBankSpider(scrapy.Spider): name = "stbank" item_attributes = {"brand": "S&T Bank"} allowed_domains = ["stbank.com"] start_urls = ["https://www.stbank.com/page-data/locat...
StarcoderdataPython
1626001
"""Defines the Data Classes used.""" import datetime from datetime import datetime as dt # pylint: disable=too-many-instance-attributes, too-many-public-methods class StationData: """A representation of all data available for a specific Station ID.""" def __init__(self, data): self._air_density = da...
StarcoderdataPython
3357851
<filename>backend/api/models.py from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from django.contrib.auth import get_user_model from datetime import datetime User = get_user_model()
StarcoderdataPython
57124
<filename>build.py #!/usr/bin/env python3 # vim: set fileencoding=utf-8: """ Build creativecommons.org primary site includes (scripts, styles, navigation header, and navigation footer) based on WordPress REST API """ # Standard library import argparse import copy import os import sys import traceback # Third-party i...
StarcoderdataPython
240796
<reponame>edilson/django_ecommerce from django.conf.urls import url from . import views urlpatterns = [ url(r'^adicionar/(?P<slug>[\w_-]+)/$', views.CreateCartItemView.as_view(), name='create_cartitem'), url(r'^carrinho/$', views.CartItemView.as_view(), name='cart_item'), url(r'^finalizando/$', views.Chec...
StarcoderdataPython
259424
<gh_stars>10-100 # ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a ...
StarcoderdataPython
315144
<filename>apysc/_display/x_interface.py """Class implementation for the x-coordinate interface. """ from typing import Dict from apysc._animation.animation_move_interface import AnimationMoveInterface from apysc._animation.animation_x_interface import AnimationXInterface from apysc._type.attr_linking_interface...
StarcoderdataPython
255739
<filename>start.py import glob from zipfile import ZipFile files = glob.glob('./*.zip') for n1 in range(0, 10): for n2 in range(0, 10): for n3 in range(0, 10): for n4 in range(0, 10): guess = ''.join(map(str, [n1, n2, n3, n4])) for n in range(len(files)): ...
StarcoderdataPython
165175
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, division from eight import * from .lca import LCA from numpy.linalg import solve class DenseLCA(LCA): def solve_linear_system(self): """ Master solution function for linear system :math:`Ax=B`. To most numerical analyst...
StarcoderdataPython
5039796
#coding=utf-8 ''' @author: <NAME> @since: 2015-02-13 ''' import httplib import json import random import re import sys import time import urllib2 reload(sys) sys.setdefaultencoding('utf8') def getRandomIP(): file_read = open('china.ip', 'r') list = file_read.readlines() file_read.cl...
StarcoderdataPython
8068205
<gh_stars>0 from dataclasses import dataclass from bindings.csw.vertical_csref_type import VerticalCsrefType __NAMESPACE__ = "http://www.opengis.net/gml" @dataclass class UsesVerticalCs(VerticalCsrefType): """ Association to the vertical coordinate system used by this CRS. """ class Meta: na...
StarcoderdataPython