id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
12821924 | <filename>apps/accounts/urls.py<gh_stars>1-10
"""resultlab URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns... | StarcoderdataPython |
9620059 | <reponame>nerdinand/shooty-game
from __future__ import annotations # to allow for forward type references
from typing import List
from typing import TYPE_CHECKING
from .collision import Collision
from .intersection_util import IntersectionUtil
from .obstacle import Obstacle
from .player import Player
if TYPE_CHECKI... | StarcoderdataPython |
143473 | from rest_framework.exceptions import APIException
class ServiceUnavailable(APIException):
status_code = 503
default_detail = 'Service temporarily unavailable, try again later.'
default_code = 'service_unavailable' | StarcoderdataPython |
9640397 | <filename>tests/unit/test_events.py
import pytest
from mugen.events import Event, EventList, EventGroupList
class Beat(Event):
pass
class Silence(Event):
pass
@pytest.fixture
def events() -> EventList:
return EventList([Silence(6),
Beat(12),
Beat(18),
... | StarcoderdataPython |
5160836 | import babyrobot.lib.config as br_config
import os
class ROS_CONFIG(object):
PSY_SERVICE_NAME = 'psycholing'
PSY_SERVER_NODE = 'psycholing_server'
PSY_CLIENT_NODE = 'psycholing_client'
PSYCHOLING_DATA = os.path.join(br_config.BASE_PATH,
'models/psycholing_data/lex')
PSY_L... | StarcoderdataPython |
6433135 | <reponame>jlmartinnc/PythonStdioGames
"""Collatz Sequence, by <NAME> <EMAIL>
Generates numbers for the Collatz sequence, given a starting number.
More info at: https://en.wikipedia.org/wiki/Collatz_conjecture
This code is available at https://nostarch.com/big-book-small-python-programming
Tags: tiny, beginner, math"""
... | StarcoderdataPython |
384989 | # <NAME>, University of Oxford
#
# An exploratory proof-of-concept implementation of a CSPRNG
# (cryptographically secure pseudorandom number generator) using
# adversarially trained neural networks. The work was inspired by
# the findings of Abadi & Andersen, outlined in the paper
# "Learning to Protect Communications... | StarcoderdataPython |
1639514 | <filename>h2o-py/h2o/frame.py
# -*- coding: utf-8 -*-
# import numpy no numpy cuz windoz
import collections, csv, itertools, os, re, tempfile, uuid, urllib2, sys, urllib,imp,copy,weakref,inspect,ast
from astfun import _bytecode_decompile_lambda
from expr import h2o,ExprNode
import gc
from group_by import GroupBy
#... | StarcoderdataPython |
4990871 | """
Write a function called draw_rect that takes a Turtle object and a Rectangle and uses the Turtle
to draw the Rectangle.
Write a function called draw_circle that takes a Turtle and a Circle and draws the Circle
"""
import turtle
from polygon import d_circle, polygon
from Circle import Circle, Rectangle, Point
de... | StarcoderdataPython |
6431719 | import sys
from django.core.management.base import BaseCommand
import feedparser
from blogger.models import sync_blog_feed
from blogger import config
class Command(BaseCommand):
help = 'Syncs existing Blogger blog via its RSS feed'
def handle(self, *args, **options):
feed = feedparser.parse(config.... | StarcoderdataPython |
12830576 | <reponame>TonyMTH/Digit-Recognizer<gh_stars>0
# Import libraries
import torch
from PIL import Image
from matplotlib import pyplot as plt
from numpy import mean
from process_user_input import Process, TransformAll
class Predict:
def __init__(self, model_path, img_pth):
self.path = model_path
self.... | StarcoderdataPython |
11227066 | <reponame>byamao1/HaboMalHunter<gh_stars>100-1000
#coding=utf-8
"""
Tencent is pleased to support the open source community by making HaboMalHunter available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in
... | StarcoderdataPython |
3425541 | <filename>examples/discord_integration.py
"""This example makes use of discord integration with fortnitepy. If captcha
is enforced for the accounts, you will only have to enter the authorization code
the first time you run this script.
NOTE: This example uses AdvancedAuth and stores the details in a file.
It is import... | StarcoderdataPython |
1814800 | <reponame>martinmatak/hands-annotation
#!/usr/bin/env python
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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/LI... | StarcoderdataPython |
3591370 | from collections import namedtuple
from csvw.metadata import Datatype
ParamInfo = namedtuple('ParamInfo', 'dt name description url type')
PARAMETER_INFO = {
'level': ParamInfo(
Datatype.fromvalue(dict(base='string', format='family|language|dialect')),
'Level',
"Languoid level information ... | StarcoderdataPython |
4941006 | import time
from common.mayastor import container_mod, mayastor_mod as mayastors
import uuid as guid
import pytest
VOLUME_COUNT = 1
def ensure_zero_devices(mayastors):
"""
Assert all nodes have no bdevs left.
"""
nodes = ["ms0", "ms1"]
for node in nodes:
bdevs = mayastors[node].bdev_lis... | StarcoderdataPython |
8190934 | import os
import numpy as np
import matplotlib as mpl
mpl.use("pgf")
general_fontsize = 16
custon_pgf_rcparams = {
"font.family": 'serif',
"font.serif": 'cm',
'font.size': general_fontsize,
'xtick.labelsize': general_fontsize,
'ytick.labelsize': general_fontsize,
'axes.labelsize': general_fonts... | StarcoderdataPython |
11211487 | # coding: utf-8
"""
eBay Finances API
This API is used to retrieve seller payouts and monetary transaction details related to those payouts. # noqa: E501
OpenAPI spec version: 1.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impo... | StarcoderdataPython |
4893491 | <reponame>kuanfan99/zeva
# Generated by Django 3.1.12 on 2021-08-13 20:07
import db_comments.model_mixins
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0120_supplementalreportsales_supplementalreportsupplierinfo... | StarcoderdataPython |
11330310 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
from nest_elephant_tvb.Tvb import tvb_sim
import numpy as np
import numpy.random as rgn
... | StarcoderdataPython |
12855489 | <filename>cykel/models/cykel_log_entry.py<gh_stars>0
from django.contrib.admin.options import get_content_type_for_model
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import... | StarcoderdataPython |
4953805 | from __future__ import absolute_import
import sublime
try:
from utils.scratch_view import ScratchView
except ImportError:
from .utils.scratch_view import ScratchView
Region = sublime.Region
def run():
# Generate new scratch file
scratch_view = ScratchView()
try:
# Injection point for inpu... | StarcoderdataPython |
8159738 | <filename>trainer.py
import torch
import random
def train(args, epoch, G, VD, ID, optimizer_G, optimizer_VD, optimizer_ID, criterion, dataloader, writer, device):
# train mode
G.train()
VD.train()
ID.train()
for i, x in enumerate(dataloader):
global_steps = epoch * len(dataloader) + i
bs = x.size(0)
real... | StarcoderdataPython |
5007963 | #! /usr/bin/env python3
import re
class Node:
def __init__(self, name):
self.name = name
self.children = []
self.parent = []
def __str__(self):
children = ", ".join(self.children)
return "%s: %s" % (self.name, children)
def __repr__(self):
return self.__str__()
with open('input/day7') as input:
line... | StarcoderdataPython |
5193093 | <filename>siam_tracker/models/fusions/xcorr.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import torch.nn.functional as F
from torch import nn, Tensor
from typing import Dict, Union, List
from .base_fusion import BaseFusion
from ..builder import FUSIONS
from ..utils ... | StarcoderdataPython |
1790930 | <gh_stars>1-10
from ..utils import load_repository_organization, load_repository_name
from ..badges import add_badge, extract_image_url
from bs4 import BeautifulSoup
import requests
def get_code_climate_badges():
url = "https://codeclimate.com/github/{organization}/{repository}/badges".format(
organizatio... | StarcoderdataPython |
4816389 | <reponame>crocs-muni/cert-validataion-stats
"""This package contains analytical functions and tools for quantitative analysis of certificate datasets."""
__version__ = '1.1'
__author__ = '<NAME>'
__all__ = (
'CertAnalyser',
'ChainValidator',
)
from .cert_analyser import CertAnalyser
from .chain_validator impo... | StarcoderdataPython |
358694 | <reponame>nuuuwan/utils<gh_stars>0
"""Test."""
import unittest
from utils import sysx
from utils.sysx import str_color
class TestSys(unittest.TestCase):
"""Test."""
def test_log_metric(self):
"""Test."""
sysx.log_metrics()
def test_run(self):
"""Test."""
output = sysx.ru... | StarcoderdataPython |
6613264 | import math
from datetime import datetime
from decimal import Decimal
from typing import Tuple
from pandas import DataFrame
from src.constants import ZERO
from src.dto.attempt_dto import AttemptDTO
from src.enums.action_enum import ActionEnum
from src.utils.utils import Utils
class StrategyBO:
# noinspection Du... | StarcoderdataPython |
222694 | <gh_stars>1-10
# 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 |
4825745 | <gh_stars>0
import numpy as np
class Graph_data_container:
def __init__(self, x:np.ndarray, y:np.ndarray, label:str) -> None:
self.x = x
self.y = y
self.label = label
@property
def xs_lim(self):
x_l = np.floor(np.log10 (max(1, min(self.x)) ))
x_u = np.ceil(n... | StarcoderdataPython |
3569382 | import numpy as np
from scipy.constants import pi
from numpy.fft import fftshift
from scipy.fftpack import fft, ifft
from six.moves import builtins
from cython_files.cython_integrand import *
import sys
assert_allclose = np.testing.assert_allclose
import numba
complex128 = numba.complex128
vectorize = numba.vectorize
... | StarcoderdataPython |
11383656 | <reponame>ChuckWoodraska/AdventOfCode2018<filename>2018/day13/day13.py
import pandas as pd
from operator import itemgetter
grid_list = []
cart_list = []
carts_to_remove = []
def find_overwritten_char(c):
if c == '>' or c == '<':
return '-'
elif c == 'v' or c == '^':
return '|'
def remove_cra... | StarcoderdataPython |
1739077 | <filename>das_import/client.py
import enum
from functools import partialmethod
from urllib.parse import urljoin
import requests
from .exceptions import CardImportError
from .types import Expansion, Card
class Endpoint(enum.Enum):
LOGIN = "/accounts/login/"
ADD_CARD = "/cards/addcard"
class Client:
bas... | StarcoderdataPython |
3403067 | <gh_stars>0
from random import *
from string import *
def randomfunc():
while(n==False):
a1=randint(0,3)
b1=randint(0,3)
if(L[a1][b1]==0):
count=randint(1,3)
if(count==1 or count==2):
L[a1][b1]=2
elif(count==3):
L[a1][b1]=4
break
def spacefunc(a,b):
if(L[a][b]<10):
return 5-1
elif(L[a][... | StarcoderdataPython |
4985021 | <reponame>junyinglucn/leetcode<gh_stars>0
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
pt1 = headA
pt2 = headB
... | StarcoderdataPython |
54716 | #!/usr/bin/env python
"""
@file signalControl.py
@author <NAME>
@date 31/01/2013
Parent class for signal control algorithms
"""
import subprocess, sys, os, platform, time
from threading import Thread
#Test to see if we're running on linux or windows
if platform.system() == 'Linux':
sys.path.append('/usr/s... | StarcoderdataPython |
276307 | # MINLP written by GAMS Convert at 04/21/18 13:52:23
#
# Equation counts
# Total E G L N X C B
# 51 51 0 0 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | StarcoderdataPython |
9783222 | <filename>codewof/programming/content/en/print-pet/solution.py
def print_pet(name, age, species):
print(name + " is a " + str(age) + "-year-old " + species + ".")
| StarcoderdataPython |
3245874 | <reponame>fetchrobotics/fetch_pbd
'''Defines behaviour for ArmTarget primitive. This is for primitives
where the arm moves to a single pose.
'''
# ######################################################################
# Imports
# ######################################################################
# System builtins
... | StarcoderdataPython |
4863819 | <reponame>bopopescu/misc-scripts<gh_stars>0
import serial
import time
devName = raw_input("Enter device name (/dev/ttyUSB0): ")
if devName in ["", None]:
devName = "/dev/ttyUSB0"
baud = raw_input("Enter baud rate (115200): ")
if baud in ["", None]:
baud = 115200
else:
baud = int(baud)
com = serial.Serial(port=... | StarcoderdataPython |
4802731 | <gh_stars>0
import streamlit as st
# import pandas as pd
import pydeck as pdk
import geofeather
roads = geofeather.from_geofeather('geodata/gis.osm_roads_free_1.feather')
railways = geofeather.from_geofeather("geodata/gis.osm_railways_free_1.feather")
road_types = ["motorway", "primary", "secondary", "railways", "roa... | StarcoderdataPython |
11330925 | <filename>src/spaceone/inventory/connector/aws_auto_scaling_connector/schema/service_type.py
from spaceone.inventory.libs.schema.dynamic_field import TextDyField, ListDyField, DateTimeDyField, SearchField, EnumDyField
from spaceone.inventory.libs.schema.resource import CloudServiceTypeResource, CloudServiceTypeResponse... | StarcoderdataPython |
1882693 | from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.utils import simplejson
from django.views.gene... | StarcoderdataPython |
9612240 | <reponame>Taeert/age-gender
from torch._C import Value
import torch.nn as nn
import torch.nn.functional as F
from base import BaseModel
import torch
class Residual(nn.Module):
"""
This module looks like what you find in the original resnet or IC paper
(https://arxiv.org/pdf/1905.05928.pdf), except th... | StarcoderdataPython |
3531718 | import logging
import re
from markdown import Markdown
from markdown.extensions.toc import TocExtension
logger = logging.getLogger(__name__)
def md_convert(source, title=""):
"""This function:
- converts Markdown source into html (excluding headers of level 1);
- generates metadata from source header;
... | StarcoderdataPython |
370103 | <filename>translate.py<gh_stars>0
#! /usr/bin/env python3
import sys
def translate_sequence(rna_sequence, genetic_code):
"""Translates a sequence of RNA into a sequence of amino acids.
Translates `rna_sequence` into string of amino acids, according to the
`genetic_code` given as a dict. Translation begin... | StarcoderdataPython |
4971776 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | StarcoderdataPython |
3372510 | <gh_stars>0
import os
import random
import string
def generate_random_text_file(filename, size):
"""
generate a random letters and write them to file
:param filename: the filename
:param size: the size in bytes
:return: void
"""
print("Generating file...")
chars = ''.join([random.choic... | StarcoderdataPython |
1620149 | <reponame>defgsus/thegame
import glm
from lib.opengl.core.base import *
from lib.opengl import *
from lib.geom import TriangleMesh, TriangleHashMesh, MeshFactory, Polygons
def make_dodec(factory, mesh, p):
def add_pentagon(p1, p2, p3, p4, p5):
mesh.add_triangle(p1, p2, p5)
mesh.add_triangle(p2, p... | StarcoderdataPython |
1605614 | <filename>main.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
@app.route('/home')
def home_page():
return render_template('home.html', title='Home Page')
@app.route('/about')
def about():
return render_template('about.html', title='About Page')
| StarcoderdataPython |
9729150 | #! /usr/bin/env python2
#
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2013. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: <EMAIL>
#
import khmer
import sys
import os
import gc
import glob
TRAVERSE_ON_UNPAR... | StarcoderdataPython |
3499483 | from collections import deque
customerLine=deque([])
while True:
customer=input("")
if customer=="Paid":
output=""
while customerLine:
output+=customerLine.pop()
if len(customerLine)!=0:
output+="\n"
print(output)
elif customer!="End":
... | StarcoderdataPython |
6574147 | <reponame>rog-works/lf3py<gh_stars>0
from datetime import date, datetime, time, tzinfo
from typing import Optional
class DateTime:
def __init__(self, tz: tzinfo) -> None:
self._tz = tz
@property
def tz(self) -> tzinfo:
return self._tz
def now(self) -> datetime:
return datetim... | StarcoderdataPython |
3572317 | __author__ = 'Will@PCVG'
# an implementation based on "lizhengwei1992"'s DeepLabV3+ pytorch version
# Utils used with tensorflow implemetation
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import copy
import functools
from ops_dup import *
import tensor... | StarcoderdataPython |
1603875 | <filename>Real Estate Admin/app.py
from flask import Flask,render_template,url_for,redirect,request,flash
from flask_mysqldb import MySQL
app = Flask(__name__)
# Mysql connection
app.config['MYSQL_HOST'] = "localhost"
app.config['MYSQL_USER'] = "root"
app.config['MYSQL_PASSWORD'] = "<PASSWORD>"
app.config['M... | StarcoderdataPython |
3568639 | <gh_stars>0
import requests
from bs4 import BeautifulSoup
YOUTUBE_TRENDING_URL = 'https://www.youtube.com/feed/trending'
response = requests.get(YOUTUBE_TRENDING_URL)
print('Status Code', response.status_code)
with open('trending.html', 'w') as f:
f.write(response.text)
doc = BeautifulSoup(response.text, 'html.p... | StarcoderdataPython |
1889620 | <reponame>wenxuefeng3930/openverse-api<filename>openverse-api/catalog/api/examples/audio_responses.py
audio_search_200_example = {
"application/json": {
"result_count": 77,
"page_count": 77,
"page_size": 1,
"results": [
{
"title": "File:Mozart - Eine klein... | StarcoderdataPython |
5026283 | <gh_stars>0
print("Hello Python")
print("什么鬼")
print("德玛西亚")
print("瞅你咋地") | StarcoderdataPython |
9756060 | <filename>tests/test_sentry.py
#
# Copyright (c) 2015-2018 Canonical, Ltd.
#
# This file is part of Talisker
# (see http://github.com/canonical-ols/talisker).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for ad... | StarcoderdataPython |
6543001 | from django.conf import settings
from django.core.urlresolvers import resolve
from django.dispatch import Signal
from six.moves.urllib import parse as urlparse
from keystoneclient.v3 import client as client_v3
import signals
import logging
LOG = logging.getLogger('django')
CONFIG = getattr(settings, 'CREATE_PROJECT'... | StarcoderdataPython |
3409638 | <gh_stars>100-1000
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | StarcoderdataPython |
6526695 | import logging
import hashlib
import hmac
import requests
from time import sleep, time
from datetime import datetime
from enum import Enum
logger = logging.getLogger('cryptocom_api')
RATE_LIMIT_PER_SECOND = 10
# LIMIT_ORDER = 1
# MARKET_ORDER = 2
# STOP_LOSS = 3
# STOP_LIMIT = 4
# TAKE_PROFIT = 5
# TAKE_PROFIT_LIMIT ... | StarcoderdataPython |
1773134 | <reponame>prppedro/mercurium<gh_stars>1-10
import config
from api import send_message
from reborn import is_sudoer
def on_msg_received(msg, matches):
# Checa se o usuário tem permissão e tem a quantidade correta de args no comando
command = matches.group(2)
plugin = matches.group(3)
if command is Non... | StarcoderdataPython |
9743433 | # Generated by Django 2.2.3 on 2019-08-05 16:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0017_auto_20190805_1539'),
]
operations = [
migrations.RemoveField(
model_name='homepage',
name='course_field_label'... | StarcoderdataPython |
6568860 | <filename>model-inference/decisionTree/experiments/higgs/HummingBird/Pytorch_Model.py
# transfer to onnx model and save
import pandas
import pickle
import joblib
import torch
import torchvision
from hummingbird.ml import convert
import numpy as np
import time
import onnx
import onnxruntime as ort
from onnxmltools impor... | StarcoderdataPython |
8108283 | from django.http import HttpResponse, HttpResponseRedirect
def cors_allow_all(orig_func):
def new_func(request, *args, **kwargs):
if request.method == 'OPTIONS':
response = HttpResponse()
else:
response = orig_func(request, *args, **kwargs)
response['Access-Control-... | StarcoderdataPython |
3574769 | <filename>samples/vsphere/oauth/grant_types/webserver.py<gh_stars>100-1000
#!/usr/bin/env python
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2020. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER.... | StarcoderdataPython |
5132323 | <filename>socialite/preprocess/gen_myria_conf.py
import os
import sys
if len(sys.argv) != 3:
print 'usage: [host list file] [myria output file]'
me = os.uname()[1]
workers_list = []
counter = 1
with open(sys.argv[1], 'r') as fi:
for line in fi:
line = line.strip('\n').strip()
if len(line) == 0:... | StarcoderdataPython |
1936009 | <filename>extract/Scraping Wikipedia - sample.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
#Here's Johnny!
import os
os.chdir('C:\\Users\\<NAME>\\Documents\\Oscar Cast')
#Oh, Jerry, don't let's ask for the moon. We have the stars
import requests
from bs4 import BeautifulSoup
from collec... | StarcoderdataPython |
11200173 | #@String name
print('Hello ' + name)
| StarcoderdataPython |
355160 | <reponame>mbmetcalfe/Abbot<gh_stars>0
#!/usr/local/bin/python3.6
import discord
from discord.ext import commands
from discord.ext.commands.bot import _get_variable
from config import Config, ConfigDefaults
from permissions import Permissions, PermissionsDefaults
from utils import load_file, write_file, sane_round_int
... | StarcoderdataPython |
5139741 | '''
This code is part of QuTIpy.
(c) Copyright <NAME>, 2021
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of t... | StarcoderdataPython |
11200835 | #===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------... | StarcoderdataPython |
4920346 | <gh_stars>0
from .finish_conditions import FinalState, Draw, Win
from .rules import *
from .board import *
from .actions import *
from src.core.classes.ply import Ply
from src.core.classes.players.player import Player
from src.core.classes.game_modes.game_mode import GameMode
from .color import Black, Color, White
c... | StarcoderdataPython |
3320060 | # -*- coding: utf-8 -*-
# Copyright (C) 2010-2018 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# ****************************************************************************
# This module is part of the package LNX.
#
# This module is licensed under the terms of the BSD 3-Clause Li... | StarcoderdataPython |
1970978 | from __future__ import unicode_literals
import mock
from hermes_python.api.ffi import FFI
from hermes_python.ontology import MqttOptions
HOST = "localhost"
def test_initialization():
h = FFI()
assert 0 == len(h.dialogue._c_callback_subscribe_intent)
def test_initialization_use_json_api_by_default():
h... | StarcoderdataPython |
235423 | input_image = itk.imread('data/BrainProtonDensitySlice.png', itk.ctype('unsigned char'))
isolated_connected = itk.IsolatedConnectedImageFilter.New(input_image)
isolated_connected.SetSeed1([98, 112])
isolated_connected.SetSeed2([98, 136])
isolated_connected.SetUpperValueLimit( 245 )
isolated_connected.FindUpperThreshold... | StarcoderdataPython |
8087297 | <gh_stars>0
from model import Model
from game import Game
class Generation:
def __init__(self, num_individuals : int):
self.models = list()
for i in range(num_individuals):
self.models.append(Model())
def CrossOver(self, model1 : Model, model2 : Model):
pass
def... | StarcoderdataPython |
3334931 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from reversibleconvolution.reversible_convolution import *
from remixer.remixer import *
class DownConv(nn.Module):
"""Some Information about DownConv"""
def __init__(self, input_channels, outp... | StarcoderdataPython |
3370356 | __author__ = 'ipetrash'
from PySide.QtGui import *
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.editor = QTextEdit()
self.setCentralWidget(self.editor)
self.setMenuBar(QMenuBar())
file_menu = self.menuBar().ad... | StarcoderdataPython |
6636760 | # Copyright 2013, 2014 Intel Corporation.
# 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
#
# Unles... | StarcoderdataPython |
11201583 | <filename>mvqag/utils/fileloader.py
import os
import pandas as pd
from typing import Union, Optional, Any, List
from pathlib import Path
from easydict import EasyDict as edict
from ruamel.yaml import YAML, yaml_object
from mvqag import PROJ_DIR
__all__ = [
# YAML
'load_yaml',
# .TXT & .CSV
'load_qa_f... | StarcoderdataPython |
8156031 | <gh_stars>0
class LoggingCount():
def assert_logging(self, count, logtype, caplog):
"""Check for expected number of errors in logging
Parameters
----------
count : int
Number of errors expected
caplog : caplog
caplog object from original method call
... | StarcoderdataPython |
18473 | # -*- coding: utf-8 -*-
"""
In this file are all the needed functions to calculate an adaptive fractionation treatment plan. The value_eval and the result_calc function are the only ones that should be used
This file requires all sparing factors to be known, therefore, it isnt suited to do active treatment planning ... | StarcoderdataPython |
9679762 | <gh_stars>1-10
import logging
from django.utils.translation import gettext_lazy as _
from sso.organisations.models import AdminRegion, OrganisationCountry
from sso.views.generic import SearchFilter, ViewQuerysetFilter
logger = logging.getLogger(__name__)
class AccessRequestCountryFilter(ViewQuerysetFilter):
nam... | StarcoderdataPython |
183156 | from stable_baselines3.ppo.ppo import PPO
from snake_ruim.envs.snake_ruim import snake_env
import gym
def main():
#creating env
env = gym.make("SnakeRuim-v0", size=20)
#creating and training model
model = PPO("MultiInputPolicy", env, verbose=1).learn(500000)
# Test the trained agent
obs = e... | StarcoderdataPython |
3306943 | <filename>notify-api/tests/unit/api/test_notify.py<gh_stars>0
# Copyright © 2019 Province of British Columbia
#
# 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/lic... | StarcoderdataPython |
1901569 | import numpy as np
fmt_dict = {
'sep': ',',
'cast_type': int
}
def solve(data, day_targets=(80, 256)):
initial_population = np.array(data, dtype=int)
age_counts = np.array([np.sum(initial_population == i) for i in range(9)], dtype=np.uint64)
result = {day:0 for day in day_targets}
fo... | StarcoderdataPython |
8122038 | <reponame>mihai-stanimir/FusionSheeter
from .FusionSheeterCommand import FusionSheeterSizeCommand, FusionSheeterCreateCommand, \
FusionSheeterSyncCommand, FusionSheeterOpenSheetCommand, FusionSheeterPaletteCommand, \
FusionSheeterQuickPullCommand, FusionSheeterDisplayCommand, FusionSheeterDisplayCreateCommand
... | StarcoderdataPython |
322271 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.utils import WarpPoints
def test_WarpPoints_inputs():
input_map = dict(args=dict(argstr='%s',
),
coord_mm=dict(argstr='-mm',
xor=['coord_vox'],
),
coord_vox=dict(argstr='-vox... | StarcoderdataPython |
393383 | <filename>wbia/dtool/copy_sqlite_to_postgres.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Copy sqlite database into a postgresql database using pgloader (from
apt-get)
"""
import logging
import re
import shutil
import subprocess
import tempfile
import traceback
import typing
from concurrent.futures import as_complete... | StarcoderdataPython |
5050174 | <filename>wk1/MeanOfASetOfFITSFiles.py
# Write your mean_fits function here:
from astropy.io import fits
import numpy as np
def mean_fits(fitsfiles):
count = 0
for fitsfile in fitsfiles:
hdulist = fits.open(fitsfile)
newdata = hdulist[0].data
if count == 0:
data = newdata
else:
d... | StarcoderdataPython |
5051076 | """
The Forum File
"""
import requests
from scratchconnect import Exceptions
_website = "scratch.mit.edu"
_login = f"https://{_website}/login/"
_api = f"https://api.{_website}"
class Forum:
def __init__(self, id, client_username, csrf_token, session_id, token):
"""
The Main Forum ... | StarcoderdataPython |
9710274 | from __future__ import print_function
import numpy as np
from scipy.linalg import eigh, expm, norm
from scipy.sparse import csr_matrix, spmatrix
from math import factorial
import warnings
from functools import reduce
try:
import qutip
except ImportError:
qutip = None
class Setup(object):
sparse = False
... | StarcoderdataPython |
3571982 | """
pyrallex2.sample.py
Version: 0.1
AUTHOR: <NAME>
Date: 4-Feb-2021
"""
import numpy as np
from sklearn.preprocessing import normalize
import PyralleX2.src.PyralleX2.cell_parse as Cell_parse
import PyralleX2.src.PyralleX2.Data.atom_param as Atom_param
class Atom:
"""
Class encapsulating Atom objects
""... | StarcoderdataPython |
5180992 | <filename>nascd/xorandor/post_train.py<gh_stars>1-10
import numpy as np
from sklearn.metrics import accuracy_score
from deephyper.post.pipeline import train
from nascd.xorandor.problem import Problem
config = Problem.space
config["hyperparameters"]["verbose"] = 1
config["arch_seq"] = [2, 1, 0]
config["id"] = 0
confi... | StarcoderdataPython |
3457704 | <reponame>AndPotap/kernel_sgd_bandwidth_selection
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# ===========================================================================
# Imports
# ===========================================================================
import numpy as np
import ... | StarcoderdataPython |
11274664 | <reponame>andymcdgeo/PyPetrophysics
import pytest
from pypetrophysics import temperature
def test_temp_gradient():
result = temperature.temp_gradient(150, 60, 8000)
assert result == pytest.approx(0.01125, abs=0.01)
def test_formation_temperature():
result = temperature.formation_temperature(60, 0.01125, 8... | StarcoderdataPython |
9702544 | """
*******************************
FrMaya
*******************************
Created By : <NAME>
Copyright : <NAME>
Email : <EMAIL>
Start Date : 10 May, 2017
Purpose :
"""
import sys
from .init import (
startup,
install,
)
from .version ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.