id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1760307 | import pytest
from guardian.shortcuts import get_perms
@pytest.mark.django_db
def test_anonymous_user_has_no_edit_perm(organizer, guardian_anonymous_user):
assert 'change_organizer' not in get_perms(guardian_anonymous_user, organizer)
@pytest.mark.django_db
def test_user_has_no_edit_perm(organizer, user):
a... | StarcoderdataPython |
1615360 | <filename>PythonDAdata/3358OS_08_Code/code8/populate_db.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from alchemy_entities import Base, Sensor, Station
def populate(engine):
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()
... | StarcoderdataPython |
3312371 | def convert(celcius):
farenheit = (celcius * 1.8) + 32
return farenheit
print('{:^5} {:^7}'.format("F", "C"))
for celcius in range(-30, 41, 5):
farenheit = convert(celcius)
print('{:5} {:7}'.format(farenheit, celcius)) | StarcoderdataPython |
51849 |
import pytest
import os
from corpustools.corpus.io.text_spelling import (load_discourse_spelling,
load_directory_spelling,
inspect_discourse_spelling,
export_discourse_spelli... | StarcoderdataPython |
4834128 | <gh_stars>1-10
from django.forms import ModelForm
from django.forms import TextInput
from django.forms import EmailInput
from django.forms import NumberInput
from survey.models import User
class UserForm(ModelForm):
class Meta:
model = User
widgets = {
... | StarcoderdataPython |
188699 | <filename>evidence_inference/models/transformer.py
'''
Transformer encoder for evidence-inference.
Note that this implementation largely cribbed and modified from the excellent
"attention is all you need" implementation by <NAME>:
http://nlp.seas.harvard.edu/2018/04/03/attention.html
'''
import numpy as np
import t... | StarcoderdataPython |
1762439 | import torch
AVAILABLE_SCHEDS = ['cosine', 'exp', 'stepLR', 'multistepLR']
def build_scheduler(cfg, optimizer):
if cfg.scheduler.name is None:
return None
assert cfg.scheduler.name in AVAILABLE_SCHEDS
if cfg.scheduler.name == 'cosine':
sched = torch.optim.lr_scheduler.CosineAnnealingLR(op... | StarcoderdataPython |
1753476 | <filename>ruco/bits.py
import collections
import inspect
import json
import os
import sys
import time
import threading
import traceback
DEBUG = 3
def format_seconds(i):
h, r = divmod(i, 3600)
m, s = divmod(r, 60)
return "%sh%sm%ss" % (h, m, s)
def xttrs(type, *args, **kwargs):
"""
Wrap an instance of a map... | StarcoderdataPython |
181249 | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
Hydra script that is used to test the HDRi Skybox component functionality inside the Editor.
Opens the MeshTest lev... | StarcoderdataPython |
140113 | from pymoo.core.problem import Problem
from pymoo.problems.meta import MetaProblem
from pymoo.util.misc import at_least_2d_array
class ConstraintsAsPenalty(MetaProblem):
def __init__(self, problem, penalty=1e6):
super().__init__(problem)
self.penalty = penalty
# set the constraints to be... | StarcoderdataPython |
4805984 | <gh_stars>10-100
from angr.storage.file import SimFile
from angr.storage.memory import SimMemory
from angr.storage.memory_object import SimMemoryObject
from angr.storage.paged_memory import SimPagedMemory
| StarcoderdataPython |
7055 | <filename>continuum/datasets/dtd.py
import os
from typing import List
import numpy as np
from torchvision import datasets as torchdata
from continuum.datasets import ImageFolderDataset
from continuum import download
from continuum.tasks import TaskType
class DTD(ImageFolderDataset):
"""Describable Textures Data... | StarcoderdataPython |
1651823 | from django.conf.urls import url
from .views.follow_user import FollowUserView, FollowUserDetailView
from .views.follow_tag import FollowTagView, FollowTagDetialView
urlpatterns = [
# user follow user
url(r'^follow_user/(?P<user_id>[\d]+)$', FollowUserView.as_view()),
url(r'^follow_user/detail/(?P<follow_... | StarcoderdataPython |
3337158 | <filename>hnjobs/__init__.py<gh_stars>0
name = "hnjobs" | StarcoderdataPython |
3299271 | <reponame>jgerrish/bitey
import json
from json import JSONDecoder
import logging
from bitey.cpu.instruction.opcode import OpcodeJSONDecoder, OpcodesJSONDecoder
from bitey.cpu.instruction.instruction import Instructions, InstructionSet
from bitey.cpu.instruction.instruction_factory import (
InstructionFactory,
... | StarcoderdataPython |
3233598 | """
Export tools for DINO 2.1 data.
"""
from . import csv, wikitable
| StarcoderdataPython |
78500 | from typing import NamedTuple, Tuple
class KgPath(NamedTuple):
id: str
# A sequence of subject, predicate, object/subject, predicate, object/subject, ..., object
path: Tuple[str, ...]
source_ids: Tuple[str, ...]
| StarcoderdataPython |
4818387 | INSTALLED_APPS += ["timezone_field"]
| StarcoderdataPython |
75508 | <filename>src/players/external_player.py
"""
A wrapper for external players that conform to the CS2 standard.
"""
import os
import subprocess
from typing import Optional
from board import Board, Loc, PlayerColor
from player import PlayerABC
class ExternalPlayer(PlayerABC):
player_command: str
def __init__(... | StarcoderdataPython |
1741776 | <filename>master/scripts/planner/solvers/hyperparameter_optimization/bayesian_optimization_min_dist_simulated_annealing.py<gh_stars>1-10
import GPy
import GPyOpt
import numpy as np
from sys import path
import pickle
import time
path.append("..")
path.append("../..")
path.append("../../..")
from solver import Simulated... | StarcoderdataPython |
191259 | <filename>utilities.py<gh_stars>0
import csv
import itertools
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow.keras
import xlrd
from tensorflow.keras import utils
from tensorflow.keras.models import Model
# import pydot, graphviz
from tensorflow.keras.utils import pl... | StarcoderdataPython |
3305822 | from pypureclient.flashblade import BucketReplicaLinkPost
# create a replica link from a specified local bucket, to a specified remote bucket
# on the remote corresponding to the remote credentials
local_bucket_names = ["localbucket"]
remote_bucket_names = ["remotebucket"]
remote_credentials_names = ["remote/credentia... | StarcoderdataPython |
25725 | from __future__ import print_function
import math
import tensorflow as tf
from sklearn.manifold import TSNE
from word2vec_input import *
from word2vec_plot import *
dataset_path = 'dataset/'
dataset = 'text8.zip'
vocabulary_size = 50000
batch_size = 128
embedding_size = 128
skip_window = 1
num_skips = 2
num_sampled =... | StarcoderdataPython |
1653065 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-17 20:56
from __future__ import unicode_literals
from django.contrib.auth.management import create_permissions
from django.db import migrations
def add_attach_perms(apps, schema):
return
Permission = apps.get_model("auth", "P... | StarcoderdataPython |
3326290 | """
Defense base game entry point.
"""
from typing import Dict, Set, Tuple, List, Any, Optional
import math
import os
import pytmx
import yaml
from beer.event import KeyCode, get_key_state
from beer.sprite import Sheet, Sprite
from beer.texture import Texture
SPRITES = []
KEYS: Set[KeyCode] = set()
MAP: Any = None
... | StarcoderdataPython |
83693 | <filename>airflow/plugins/operators/load_fact.py
import logging
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadFactOperator(BaseOperator):
"""
Custom operator to load data from staging tables into fact ... | StarcoderdataPython |
3340361 | from django.urls import path
from . import views
# Refer to the corresponding view function for more detials of the url routes
urlpatterns = [
path('', views.getRoutes, name="index"),
path('add-post/', views.addPost, name='add'),
path('get-posts/', views.getPosts, name='getPosts'),
path('add-comment... | StarcoderdataPython |
3399200 | import numpy as np
import cv2
import time
import tensorflow as tf
from tracker import Tracker
import argparse
from Tkinter import Tk
from tkFileDialog import askopenfilename
app = None
def hi(val):
print("hi")
class Application:
mode = 'TRACK'
frame = None
trackers = []
def __init__(self, mode=... | StarcoderdataPython |
1778683 | def foo():
return 0
| StarcoderdataPython |
4820709 | <gh_stars>0
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import os
from xia2.Driver.DriverFactory import DriverFactory
def LabelitDistl(DriverType=None):
"""Factory for LabelitDistl wrapper classes, with the specified
Driver type."""
DriverInstance = DriverFac... | StarcoderdataPython |
3229273 | import argparse
import gym
from gym import spaces
import cv2
cv2.ocl.setUseOpenCL(False)
import pygame
import sys
import time
import matplotlib
import numpy as np
import pickle
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from run_test import *
from baselines.common.trex_utils impor... | StarcoderdataPython |
184192 | <reponame>Belval/Scanner3D
"""
Raise classes to top-level
"""
from .base_metric import BaseMetric
from .fitness import Fitness
from .rmse import RMSE
| StarcoderdataPython |
4817188 | print render_template('index.html') | StarcoderdataPython |
12341 | <reponame>LiuYuWei/service-data-eda-analysis
"""Confusion matrix calculation service."""
# coding=utf-8
# import relation package.
from pandas_profiling import ProfileReport
import pandas as pd
import datetime
import json
# import project package.
from config.config_setting import ConfigSetting
class EdaService:
... | StarcoderdataPython |
1661806 | <reponame>justynaekert/course-content-dl
def custom_torch_RSM_fct(features):
"""
custom_torch_RSM_fct(features)
Custom function to calculate representational similarity matrix (RSM) of a feature
matrix using pairwise cosine similarity.
Required args:
- features (2D torch Tensor): feature matrix (nbr items... | StarcoderdataPython |
1614613 | <gh_stars>100-1000
"""
Creates LMDB files with extracted graph features from provided *.extxyz files
for the S2EF task.
"""
import argparse
import glob
import multiprocessing as mp
import os
import pickle
import random
import sys
import ase.io
import lmdb
import numpy as np
import torch
from tqdm import tqdm
from oc... | StarcoderdataPython |
152619 | <filename>my_homepage/contact_me/forms.py
from django import forms
from my_homepage.contact_me.models import NewContact
class NewContactForm(forms.ModelForm):
'''Form to process new contacts from the homepage'''
def __init__(self, *args, **kwargs):
super(NewContactForm, self).__init__(*args, **kwarg... | StarcoderdataPython |
1733530 | import torch
import tqdm
from utils.metrics import evaluate
from torch.utils.data import DataLoader
from utils.metrics import Metrics
from dataset.Dataset import TestDataset
from config.config import DefaultConfig
import torch.nn.functional as F
import os
import numpy as np
import imageio
from PIL import Image
from m... | StarcoderdataPython |
1655931 | <reponame>rohe/oictest
from tests import *
class ResourceSetRegistrationNoPAT(PostRequest):
request = "ResourceSetDescription"
def __init__(self, conv):
PostRequest.__init__(self, conv)
self.kw_args = {"authn_method": ""}
PHASES = {
"login": (AuthorizationRequestCode, AuthzResponse),
... | StarcoderdataPython |
3298031 | <gh_stars>1-10
#!/usr/bin/env python3 -u
import contextlib
import io
import sys
import os
import pickle
if __name__ == "__main__":
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
from fairseq_cli.generate import main
import sys
from fairseq import options
directory = "/ext2/bjlee/fairseq_c... | StarcoderdataPython |
1738351 | <reponame>AcckiyGerman/django_informixdb
__version__ = '1.3.3'
| StarcoderdataPython |
39376 | from django.shortcuts import render, redirect
from django.urls import reverse
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from .models i... | StarcoderdataPython |
172393 | # Generated by Django 2.0.1 on 2019-08-09 17:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0017_remove_trip_route_trip_image'),
]
operations = [
migrations.AlterField(
model_name='plannedtrip',
na... | StarcoderdataPython |
1793000 | import numpy as np
import math as m
import matplotlib.pyplot as plt
def minimize(angle):
while angle >= 2 * m.pi:
angle -= 2 * m.pi
return angle
def move(x, y, angle):
x += m.cos(angle)
y += m.sin(angle)
return x, y
def sel(listt, index):
temp = []
for i in listt:
temp.a... | StarcoderdataPython |
3370150 | <reponame>JulianoGianlupi/nh-cc3d-4x-base-tool
from cc3d import CompuCellSetup
from .BoundaryMonitorExampleSteppables import BoundaryMonitorSteppable
CompuCellSetup.register_steppable(steppable=BoundaryMonitorSteppable(frequency=1))
CompuCellSetup.run()
| StarcoderdataPython |
24842 | #!/usr/bin/env python3
# Copyright (2021-) <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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
1732464 | <gh_stars>1-10
class Requirements(object):
"""
A light wrapper around some sets, encoding the idea that:
1. We always want to iterate the same set
2. We want to exhaust the set as constraints are satisfied
3. We need to know what constraints are unsatisfied
4. Some constraints should be checked... | StarcoderdataPython |
78938 | <reponame>allengarvin/infocom-copy-protection
#!/usr/bin/python3
# Left to do:
# Ballyhoo (have a fix already)
# Border Zone (don't remember)
# Cutthroats (have a complicated fix)
# Seastalker
# Shogun (ugh... I don't remember)
# Zork Zero (TONS of copy protection--need to review)
# Wishbringer
# Suspended (no copy ... | StarcoderdataPython |
3360268 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatev... | StarcoderdataPython |
1601806 | import unittest
from WorkTimeSaver.salary import Salary
from WorkTimeSaver.document import Record, Document
from datetime import datetime
from os import remove
class TestSalary(unittest.TestCase):
def test_days_add(self):
salary = Salary()
for _ in range(20):
salary.update_work(480)
... | StarcoderdataPython |
177585 | from torchsketch.data.datasets.tu_berlin.download_tu_berlin import download_tu_berlin | StarcoderdataPython |
1787158 | '''
05 - Adding error-bars to a bar chart
Statistical plotting techniques add quantitative information for comparisons into the
visualization. For example, in this exercise, we will add error bars that quantify not
only the difference in the means of the height of medalists in the 2016 Olympic Games,
but also the s... | StarcoderdataPython |
1688180 | from django import forms
from .models import Leave
import datetime
class DateInput(forms.DateInput):
input_type= 'date'
class LeaveCreateForm(forms.ModelForm):
reason = forms.CharField(required=False, widget=forms.Textarea(attrs={'rows': 4, 'cols': 40}))
class Meta:
model = Leave
exclude = ['username','max... | StarcoderdataPython |
1734382 | <gh_stars>0
import os
import subprocess
from unittest import mock
from . import *
from .... import *
from mopack.builders.bfg9000 import Bfg9000Builder
from mopack.config import Config
from mopack.path import Path
from mopack.sources import Package
from mopack.sources.apt import AptPackage
from mopack.sources.sdist i... | StarcoderdataPython |
1612902 | <filename>InquirerPy/separator.py
"""Module contains the :class:`.Separator` class."""
class Separator:
"""A non selectable choice that can be used as part of the choices argument in list type prompts.
It can be used to create some visual separations between choices in list type prompts.
Args:
l... | StarcoderdataPython |
12599 | #!/usr/bin/env python
#
# $Id$
#
"""
Note: this is targeted for python 2.x.
To run it under python 3.x you need to use 2to3 tool first:
$ 2to3 -w test/test_memory_leaks.py
"""
import os
import gc
import sys
import unittest
import psutil
from test_psutil import reap_children, skipUnless, skipIf, \
... | StarcoderdataPython |
189052 | # 🚀 this project was made by KiwiiTheBird.
# ⚠️ Any questions or suggestions? Feel free to DM me on Discord: KiwiTheBird#1259
# 🛠 Created on 22/12 2020
# 🖥 Version: 1.0
import requests
import bs4
import time
def main():
main.url = 'https://namemc.com/search'
with open('usernames.txt') as file:
... | StarcoderdataPython |
3204447 | # try to import the GPIO module on the raspberry pi
# fallback to the mock implementation for dev and testing
try:
import RPi.GPIO as gpio
except ImportError:
import components.gpio as gpio
class Engine:
"""
Base class for all engines.
Provides basic functionality like forwards, backwards and stop... | StarcoderdataPython |
3330287 | <gh_stars>1-10
import redis
import json
r=redis.Redis()
users={"marten", "filip"}
out_path = '../../LongTailQATask/QuestionCreation/ref_texts.json'
out_json = {}
for user in users:
pattern="str:%s:txt:*" % user
for key in r.scan_iter(pattern):
inc_id = key.decode('utf-8')
ref_texts = r.get(k... | StarcoderdataPython |
1784861 | # copyright
import time
import torch
import networkx as nx
from torch.nn import Linear
from torch_geometric.nn import GCNConv
from torch_geometric.datasets import KarateClub
from torch_geometric.utils import to_networkx
# Helper function for visualization.
import matplotlib.pyplot as plt
# Visualization function for ... | StarcoderdataPython |
196953 | # working on final project to combine all the learnt concepts into 1
# problem statement.
#The CTO wants to monitor all the computer usage by all engineers. Using Python ,
# write an automation script that will produce a report when each user logged in and out,
# and how long each user used the computers.
# writing ... | StarcoderdataPython |
3328506 | <gh_stars>0
raio = float(input())
volume = (4.0/3.0) * 3.14159 * raio**3.0
print('VOLUME = {:.3f}'.format(volume)) | StarcoderdataPython |
3236088 | from osbot_aws.helpers.Lambda_Helpers import log_to_elk
from osbot_aws.Dependencies import load_dependencies
def run(event, context):
try:
load_dependencies(["gmail", "elastic-slack", 'requests']) # load dependency (download and unzip if first run)
from osbot_gsu... | StarcoderdataPython |
99300 | <gh_stars>1-10
from __future__ import annotations
from typing import Iterator, Literal
from prettyqt import constants, core, gui, iconprovider
from prettyqt.qt import QtWidgets
from prettyqt.utils import InvalidParamError, bidict, types
mod = QtWidgets.QTreeWidgetItem
CHILD_INDICATOR_POLICY = bidict(
show=mod.... | StarcoderdataPython |
1791796 | <reponame>kevinbazira/revscoring<filename>revscoring/datasources/__init__.py
"""
This module implements a set of
:class:`~revscoring.Datasource`
processors that represent the input data for extracting
:class:`~revscoring.Feature` values. Just like
:class:`~revscoring.Feature` and other
:class:'~revscoring.Dependent' p... | StarcoderdataPython |
1799779 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-03 08:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('observations', '0011_auto_20190401_1343'),
]
operations = [
migrations.Add... | StarcoderdataPython |
172410 | <filename>hubcare/metrics/issue_metrics/activity_rate/serializers.py<gh_stars>1-10
from rest_framework import serializers
from .models import ActivityRateIssue
class ActivityRateIssueSerializer(serializers.ModelSerializer):
class Meta:
model = ActivityRateIssue
fields = [
'activity_ra... | StarcoderdataPython |
3302105 | <gh_stars>1-10
import sys
import time
RATE_LIMIT_INTERVAL_SECONDS = 0.1
class Progress:
def __init__(self, args, total_commits):
self.args = args
self.current_commit = 1
self.total_commits = total_commits
self.last_print = None
def print_state(self, current_file, total_fil... | StarcoderdataPython |
33618 | <reponame>byu-imaal/dns-cookies-pam21
"""
Collection of functions for analyzing repeat cookie data
Designed to run a single function via CLI
"""
import argparse
import inspect
import json
import math
import subprocess
import sys
from collections import Counter
from collections import defaultdict
from shared.colors im... | StarcoderdataPython |
1631942 | import requests
from parser import get_parser
from email_sender import send_mail
def get_posts():
output = []
for parser, url in url_list:
response = requests.get(url)
output.append(get_parser(parser).parse(response))
return output
def send_posts(update_list):
contact_list = ["<EMAIL... | StarcoderdataPython |
193161 | """
webcolors.py by <NAME>.
http://pypi.python.org/pypi/webcolors/
License :: OSI Approved :: BSD License
v.1.4
Utility functions for working with the color names and color value
formats defined by the HTML and CSS specifications for use in
documents on the Web.
What this module supports
-------------------------... | StarcoderdataPython |
133814 | <filename>tests/test_fingers/test_theme/test_finger.py
import unittest
class ThemeFingerTestCase(unittest.TestCase):
pass
| StarcoderdataPython |
67599 | #!/usr/bin/env python
# coding=utf-8
# Filename: jpp.py
# pylint: disable=
"""
Pump for the jpp file read through aanet interface.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from km3pipe import Pump, Blob
from km3pipe.dataclasses import (EventInfo, TimesliceFrameInfo,
... | StarcoderdataPython |
129244 | from . import AbstractPlayer
import vlc
class VLCPlayer(AbstractPlayer):
def __init__(self):
self.player = vlc.MediaPlayer()
self.program = None
def open(self, program):
self.player.set_mrl(program.media.path)
def play(self):
self.player.play()
def stop(self):
... | StarcoderdataPython |
3225492 | import torch
import argparse
import kornia
import imageio
import numpy as np
import torch.nn as nn
# from train import HomographyModel
import os,glob
import os.path as osp
#修改
from dataset import SyntheticDataset, MEAN, STD
from dataset import SyntheticDataset, safe_collate
from model import Net, ph... | StarcoderdataPython |
1735320 | <filename>scripts/linters/warranted_angular_security_bypasses.py
# coding: utf-8
#
# Copyright 2020 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | StarcoderdataPython |
1629108 | # Copyright (c) Facebook, Inc. and its affiliates.
import gc
import unittest
import tests.test_utils as test_utils
import torch
from mmf.common.sample import SampleList
from mmf.models.uniter import (
UNITERForClassification,
UNITERForPretraining,
UNITERImageEmbeddings,
UNITERModelBase,
)
from mmf.util... | StarcoderdataPython |
16144 | <reponame>aezhov/sw_downloader
import requests
from scrapy.http import HtmlResponse
from sw_downloader.sw_downloader.spiders.smashing_magazine \
import SmashingMagazineSpider
class TestSmashingMagazineSpider:
def test_ruleset(self):
url = ('https://www.smashingmagazine.com/category/wallpapers')
... | StarcoderdataPython |
1694274 | import logging
from statsdecor.clients import (
DogStatsdClient,
StatsdClient
)
log = logging.getLogger(__name__)
_config = {}
_stats_client = None
def _create_client(**config):
vendor = config.pop('vendor', None)
if vendor == 'datadog':
client_config = _create_client_config(config, {'host',... | StarcoderdataPython |
170969 | <filename>02_neural_networks/2-5_project_1_predicting_bike_sharing_patterns/project_1_pytorch/my_answers.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNetwork(nn.Module):
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
super().__init__()
... | StarcoderdataPython |
111160 | <reponame>block1o1/CryptoPredicted
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 <NAME> <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Li... | StarcoderdataPython |
3397649 | """
Tests std::queue functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestQueue(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
@skipIf(compiler=no_match("clang"))
def test... | StarcoderdataPython |
126941 | # NLP written by GAMS Convert at 04/21/18 13:52:31
#
# Equation counts
# Total E G L N X C B
# 3 3 0 0 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | StarcoderdataPython |
70539 | # Copyright 2020 The Netket Authors. - All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | StarcoderdataPython |
1650387 | <filename>server/src/subscription/__init__.py<gh_stars>0
# Copyright 2010-2019 <NAME>, <NAME>
#
# 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/... | StarcoderdataPython |
4836217 | <gh_stars>0
from flask import Flask, render_template, request
from parser import site_parsing
from parser_2 import site_parsing_2
from parser_3 import site_parsing_3
app = Flask(__name__)
@app.route('/')
@app.route('/main')
def main_page():
return render_template('main.html')
@app.route('/parser')
def show_parsing_... | StarcoderdataPython |
3302336 | class node(object):
def __init__(self, val, next):
self.val = val
self.next = next
class l_list(object):
def __init__(self):
self.num_nodes = 0
self.head = None
def insert(self, val):
if self.head is None:
self.head = node(val, None)
else:
... | StarcoderdataPython |
1702182 | <gh_stars>1-10
import argparse
import sys
from unittest.mock import patch, MagicMock
from contextlib import contextmanager
from harmony import cli, util
def mock_receive(cfg, client, parser, AdapterClass, *messages):
"""
Mocks an sqs receive call
"""
sqs = MagicMock()
side_effects = []
for i... | StarcoderdataPython |
3216258 | # By @Danish_00
# Fixed By a NOOB
# Made for DARK COBRA by team Cobra..
# kang with credits do not edit these lines..
from telethon.tl.types import MessageMediaPhoto
import os, urllib, requests, asyncio
from userbot.utils import admin_cmd
from userbot import CMD_HELP
DARKCOBRA = Config.DEEP_AI if Config.DEEP_AI else ... | StarcoderdataPython |
144441 | <filename>main.py
from repldex.config import DOT_ENV
print('starting')
if DOT_ENV:
from dotenv import load_dotenv
load_dotenv()
# Don't move this up, env must be loaded first
from repldex.backend import api
from repldex.discordbot import bot as discordbot
from repldex.backend import website
website.start_server(... | StarcoderdataPython |
1682046 | <gh_stars>0
#Import operating system and csv
import os
import csv
#Open and read csv
budget_csv = os.path.join("budget_data.csv")
with open(budget_csv, "r") as csvfile:
csvreader = csv.reader(csvfile, delimiter=",")
print(csvreader)
next(csvreader)
#Lists to store data
date = []
#Read through ea... | StarcoderdataPython |
3277848 | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import (
StringField,
DateTimeField,
SubmitField,
TextAreaField,
)
from wtforms import HiddenField
from wtforms import validators
from wtforms.validators import DataRequired, Length
from config import Config
... | StarcoderdataPython |
3229138 | <gh_stars>0
# Generated by Django 2.0.4 on 2018-05-24 09:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('building', '0004_auto_20180524_1656'),
]
operations = [
migrations.RemoveField(
model_name='buildingpost',
name=... | StarcoderdataPython |
109863 | from pathlib import Path
current_dir = Path(__file__).parent.absolute()
import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
# [2021-06-30] TD: Somehow I get segfault if I import pl_bolts *after* torchvision
from pl_bolts.datamodules import CIFAR10DataModule
from torchvision import transforms,... | StarcoderdataPython |
3269386 | def my_decorator(my_function):
def inner_decorator():
print("This happened before!")
my_function()
print("This happens after ")
print("This happened at the end!")
return inner_decorator
@my_decorator
def my_decorated():
print("This happened!")
if __name__ == '__main__':
... | StarcoderdataPython |
3293938 | import pya
# Netlist extraction will merge straight+bend sections into waveguide (1),
# or extract each bend, straight section, etc. (0)
#WAVEGUIDE_extract_simple = 1
SIMPLIFY_NETLIST_EXTRACTION = True
# Create GUI's
from .core import WaveguideGUI, MonteCarloGUI, Net, Component
WG_GUI = WaveguideGUI()
MC_GUI = MonteC... | StarcoderdataPython |
1670151 | <filename>analysis/migrations/0004_auto_20200508_2040.py
# Generated by Django 3.0.2 on 2020-05-08 12:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('analysis', '0003_auto_20200508_0705'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
1661318 | from streamlink.plugins.periscope import Periscope
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlPeriscope(PluginCanHandleUrl):
__plugin__ = Periscope
should_match = [
'https://www.periscope.tv/Pac12Networks/1BdGYRLyzMyJX',
'https://www.periscope.tv/w/1YqKDdaoVXLKV'... | StarcoderdataPython |
1749118 | from modules.android.super_base import Super_base
from modules.stix.stix_base import Bundled
from utils.logger import Logger
from utils.mitigations import load_mitigation
class Certificate_keystore_disclosure(Super_base):
"""
Check if the application has a certificate or keystore
"""
stix = Bundled(... | StarcoderdataPython |
3308642 | <gh_stars>1-10
# coding: utf-8
from __future__ import division
import os
from .interface import Detector as BaseDetector
from .util import Sam, SamSearchBaseHandler
class SearchHandler(SamSearchBaseHandler):
def __init__(self, t=4):
super(SearchHandler, self).__init__()
self.res = []
s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.