id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
17641 | import torch
from torch import nn
from torch.autograd import Variable
import config
def init_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
nn.init.xavier_normal_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
def conv(in_chann... | StarcoderdataPython |
4841177 |
''' show this error example
my_value=10
for i in my_value:
print(i)
'''
name="Gaurav"
for eachChar in name:
print(eachChar)
for eachChar in name:
print(eachChar.capitalize(), end="")
print()
#overwriting newline backslash with space in using end=" "
for eachChar in name:
print(eachChar,end=" ")
pri... | StarcoderdataPython |
3346370 | <reponame>dkoguciuk/frustum-pointnets
''' Prepare KITTI data for 3D object detection.
Author: <NAME>
Date: September 2017
'''
from __future__ import print_function
import os
import sys
import numpy as np
import cv2
from PIL import Image
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(... | StarcoderdataPython |
168511 | <filename>commercialoperator/migrations/0009_auto_20191001_2322.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-10-01 15:22
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
... | StarcoderdataPython |
71377 | <reponame>lbjsnower/Learning_leetcode<filename>20210218-n-13罗马数字转整数.py<gh_stars>0
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
lm2int = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500,
"M": 1000}
s_len_num =... | StarcoderdataPython |
4801744 | <gh_stars>1-10
#
# Copyright (c) 2019, Infosys Ltd.
#
# 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 o... | StarcoderdataPython |
91117 | <reponame>PhilHarnish/forge
from puzzle.puzzlepedia import puzzle
def get():
return puzzle.Puzzle('Pride Parade', SOURCE)
SOURCE = """
position in range(1, 7 + 1)
color in {orange, blue, violet, green, pink, red, yellow}
name in {Phyllis, Patria, Harvey, Courtney, Kimball, Li, Christopher}
direction in {left, rig... | StarcoderdataPython |
1681094 | # This file is just Python, with a touch of Django which means
# you can inherit and tweak settings to your hearts content.
from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': '{{ sentry_db_name }... | StarcoderdataPython |
46755 | <reponame>QuarkChain/pyquarkchain
import sys
from quarkchain.evm.state import State
from quarkchain.evm.common import FakeHeader
from quarkchain.evm.utils import (
decode_hex,
parse_int_or_hex,
sha3,
to_string,
remove_0x_head,
encode_hex,
big_endian_to_int,
)
from quarkchain.evm.config impo... | StarcoderdataPython |
1644209 | # Generated by Django 2.1.2 on 2018-11-21 01:48
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ClinicalTrial',
fields=[
('id', models.Auto... | StarcoderdataPython |
36938 |
import os
import pandas as pd
import shutil
os.chdir("../Downloads/DeepWeeds_Images_256")
try:
os.mkdir("train")
os.mkdir("val")
except:
pass
train = pd.read_csv("../train_set_labels.csv")
val = pd.read_csv("../test_set_labels.csv")
print(train)
for j,i in train.iterrows():
try:
os.mkdir("tr... | StarcoderdataPython |
3369678 | import nvidia.dali.fn as fn
import nvidia.dali as dali
import subprocess
import numpy as np
import cv2
import sys
import os
def setup_dali(
image_file='/mnt/data/DATASETS/samples/images/image_110.jpg',
image_dim=[800, 1600],
batch_size=1,
num_threads=4,
device='mixed',
device_id=0,
output... | StarcoderdataPython |
3232469 | <filename>src/jenkins_tui/widgets/__init__.py
from .build_queue_widget import JenkinsBuildQueue
from .build_table_widget import JenkinsBuildTable
from .executor_status_widget import JenkinsExecutorStatus
from .footer_widget import JenkinsFooter
from .header_widget import JenkinsHeader
from .job_info_widget import Jenki... | StarcoderdataPython |
1605086 | # import os
# os.chdir("/home/buura/Desktop/Python/AdventOfCode2020")
""" This must be the hardest question of all... Also, this has the slowest compile time among the others. """
import copy
def seatsFileMap():
with open("Day11.txt", "r") as f:
return [list(i) for i in f.read().splitlines()]
def part1(... | StarcoderdataPython |
3354455 |
import mltk
from mltk.utils.test_helper import run_mltk_command
def test_version():
retmsg = run_mltk_command('--version')
assert retmsg.strip() == mltk.__version__
def test_help():
run_mltk_command( '--help')
| StarcoderdataPython |
83014 | def _root_path(f):
if f.is_source:
return f.owner.workspace_root
return "/".join([f.root.path, f.owner.workspace_root])
def _colon_paths(data):
return ":".join([
f.path
for f in sorted(data)
])
def encode_named_generators(named_generators):
return ",".join([k + "=" + v for ... | StarcoderdataPython |
90041 | from rec_to_nwb.processing.nwb.components.associated_files.fl_associated_file import FlAssociatedFile
class FlAssociatedFilesBuilder:
@staticmethod
def build(name, description, content, task_epochs):
return FlAssociatedFile(name, description, content, task_epochs)
| StarcoderdataPython |
3384694 | <reponame>Riteshbansal/BigDataTextSummarization<filename>training_data_scripts/preprocessForFastRL.py
import json
import os
import io
data = []
for line in open('All_filtered_related_wiki_gensim_v5.json', 'r', encoding = "utf-8"):
data.append(json.loads(line))
i = -1
import pickle as pkl
import collections
vocab_... | StarcoderdataPython |
1780579 | <reponame>dcs4cop/xcube-gen
# The MIT License (MIT)
# Copyright (c) 2020 by the xcube development team and contributors
#
# 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 restriction, ... | StarcoderdataPython |
1664275 | <filename>pymdown/util.py
"""
Uitl.
PyMdown file utillity library.
Licensed under MIT
Copyright (c) 2014 <NAME> <<EMAIL>>
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import print_function
import sys
import traceback
import codecs
import re
import yaml
import os
i... | StarcoderdataPython |
1723050 | <gh_stars>1-10
from django.http import HttpResponse
from django.shortcuts import render
import sqlite3
import pandas as pd
import numpy as np
import collections
import matplotlib.pyplot as plt
# Create your views here.
def index(request):
path = request.path
resultstr = ''
if path == '/index':
re... | StarcoderdataPython |
1611121 | # kalo gak tau cara gunain nya gak usah pake ya asw
# kalo ada yang error fix sendiri aja :v
# only marshal or zlib base64 from https://github.com/Dumai-991/
#open scored
import os
import re
import sys
try: import uncompyle6
except: os.system("python -m pip install uncompyle6")
########################################... | StarcoderdataPython |
3348368 | <reponame>ltlancas/gala
# coding: utf-8
""" Astropy coordinate class for the Sagittarius coordinate system """
from __future__ import division, print_function
# Third-party
import astropy.units as u
import numpy as np
from astropy.coordinates import frame_transform_graph
import astropy.coordinates as coord
import ... | StarcoderdataPython |
3216643 | import pygame
def main():
# declare the size of the canvas
width = 500
height = 500
blue_color = (97, 159, 182)
pygame.init()
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Simple Example')
clock = pygame.time.Clock()
# Game initialization
hero_i... | StarcoderdataPython |
3307295 | <filename>logicallake/grammar/util/Extract_BNF_From_HTML.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 13:38:17 2020
@author: kbzg512
"""
from lxml import html
from bs4 import BeautifulSoup
from html import unescape
from pathlib import Path
BASE_DIR = "C:\\Users\\kbzg512\\OneDrive - AZCollaboration\\Pers... | StarcoderdataPython |
1625493 | from datetime import timedelta
from enum import Enum
from dataclasses import dataclass
from itertools import groupby
from stages import StageStatus
from util import next_weekday, next_day_of_week
class DeployPolicy(Enum):
EveryPassing = "Every Passing",
OnceAWeek = "Once a Week"
OnceADay = "Once a Day"
... | StarcoderdataPython |
150348 | from zdppy_mysql import Mysql
m = Mysql(db="test")
# 查询“95031”班的学生人数。
sql = """
select count(*)
from student
where student.CLASS = '95031';
"""
m.log.info(m.fetchone(sql))
| StarcoderdataPython |
1631352 | # -*- coding: utf-8 -*-
"""Discretely test functionality of our custom TextWrapper"""
from __future__ import unicode_literals
from tabulate import _CustomTextWrap as CTW
from textwrap import TextWrapper as OTW
from common import skip, assert_equal
def test_wrap_multiword_non_wide():
"""TextWrapper: non-wide ch... | StarcoderdataPython |
177534 | <reponame>cryptobellum/Weightlifting-project
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_daq as daq
import dash_html_components as html
from dash.dependencies import Input, Output, State
from sklearn.pipeline import make_pipeline
from sklearn.metrics import ... | StarcoderdataPython |
1764176 | <filename>thriftybuilder/storage.py<gh_stars>0
import json
import os
from abc import ABCMeta, abstractmethod
from copy import copy
from typing import Optional, Dict, Mapping, Type
from urllib.parse import urlparse
from thriftybuilder.common import MissingOptionalDependencyError
class ChecksumRetriever(metaclass=ABCM... | StarcoderdataPython |
43047 | # the simplex projection algorithm implemented as a layer, while using the saliency maps to obtain object size estimates
import sys
sys.path.insert(0,'/home/briq/libs/caffe/python')
import caffe
import random
import numpy as np
import scipy.misc
import imageio
import cv2
import scipy.ndimage as nd
import os.path
import... | StarcoderdataPython |
3225801 | # Copyright 2019 Open Source Robotics Foundation, 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/licenses/LICENSE-2.0
#
# Unless required by applicable law... | StarcoderdataPython |
3308663 |
from typing import Tuple
from rectgle import Rectgle
from terrain import Terrain
from math import tan, sqrt
from queue import PriorityQueue
import numpy as np
RACINEDEDEUX = sqrt(2)
class Calculateur():
def __init__(self, depart, arrivee, rectangle: Rectgle, terrain: Terrain):
"""calcule la... | StarcoderdataPython |
1719400 | <reponame>juansahe/shoppy
default_app_config = 'administrations.apps.AdministrationsConfig'
| StarcoderdataPython |
25068 | <reponame>alenaizan/resp<filename>examples/example2.py<gh_stars>1-10
import psi4
import resp
# Initialize two different conformations of ethanol
geometry = """C 0.00000000 0.00000000 0.00000000
C 1.48805540 -0.00728176 0.39653260
O 2.04971655 1.37648153 0.25604810
H 3.06429978 1.37151670 0.52641124
... | StarcoderdataPython |
3226356 | <filename>qutip/tests/test_floquet.py<gh_stars>1-10
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... | StarcoderdataPython |
3363625 | import os
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecr as ecr
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_logs as logs
from aws_cdk import core
class RemoteWorkstationStack(core.Stack):
def __init__(
self,
scope: core.Construct,
construct_id: str,
... | StarcoderdataPython |
3338508 | <reponame>gleicon/imager
#!/usr/bin/env python
# coding: utf-8
#
# Copyright YEAR Foo Bar
# Powered by cyclone
#
# 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/li... | StarcoderdataPython |
1739262 | <filename>applications/reports/aci-report-switch.py
#!/usr/bin/env python
################################################################################
# _ ____ ___ ____ _ #
# / \ / ___|_ _| | _ \ ___ _ __ ___ _ __| |_ ___ #
# ... | StarcoderdataPython |
1681571 | <gh_stars>1-10
#!/usr/bin/env python
#
# Support for neuroimage data in argparse
#
# Author: <NAME> <<EMAIL>
#
"""This module contains support for neuroimaging data in argparse
Argparse is the built-in python library for resolving command line arguments.
The functions in this module can be passed on to the ``type`` a... | StarcoderdataPython |
1758478 | <reponame>pflun/learningAlgorithms
class Solution:
# @param {int} n non-negative integer, n posts
# @param {int} k non-negative integer, k colors
# @return {int} an integer, the total number of ways
def numWays(self, n, k):
if n == 0:
return 0
if n == 1:
return k
... | StarcoderdataPython |
1608074 | #
# Copyright (C) 2009-2017 <NAME>. See LICENSE.txt for details.
#
import logging
import logutils
import os
import sys
import unittest
class FormatterTest(unittest.TestCase):
def setUp(self):
self.common = {
'name': 'formatter.test',
'level': logging.DEBUG,
'pathname': o... | StarcoderdataPython |
43987 | # -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2012 <NAME>, Opera Software ASA
#
# 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
#
# Unl... | StarcoderdataPython |
1773379 | import pandas as pd
import plotly.express as px
import os
import sys
from datetime import datetime
import time
import gzip
import plotly
import shutil
import plotly.graph_objects as go
# class GroupBucket(list):
JANUS_HOME = "/Users/dporter/projects/janus"
def get_py(py):
"""helper function that returns name of... | StarcoderdataPython |
34604 | from provider.base import BaseProvider
class FacebookProvider(BaseProvider):
def __init__(self, client_id, client_secret, name, redirect_uri, state=None):
"""
:param client_id:
:param client_secret:
:param name:
:param redirect_uri:
:param state:
... | StarcoderdataPython |
1602419 | <reponame>davidramirezm30/scratch-orangepi<gh_stars>0
#!/usr/bin/env python
import urllib2
import json
class CheerLights():
def __init__(self):
self.lastID = 0
self.urlRoot = "http://api.thingspeak.com/channels/1417/"
self.colours = []
# retrieve and load the JSON data into a JSON obj... | StarcoderdataPython |
80243 | <gh_stars>1-10
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
def get_counter(check, metric_name, modifiers, global_options):
"""
https://prometheus.io/docs/concepts/metric_types/#counter
https://github.com/OpenObservability/OpenMetrics/b... | StarcoderdataPython |
1749762 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of the bapsflib package, a Python toolkit for the
# BaPSF group at UCLA.
#
# http://plasma.physics.ucla.edu/
#
# Copyright 2017-2018 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "LICENSES/LICENSE.txt" for full
# l... | StarcoderdataPython |
3268684 | #!/usr/bin/python3
'''
Created on 01.05.2015
@author: kinders
'''
import sys
import os
dire = os.path.dirname(__file__)
dire = os.path.dirname(dire)
dire = os.path.join(dire,"lib")
dire = os.path.join(dire,"lotto")
if dire not in sys.path:
sys.path.append(dire)
del dire
import dialogs # @UnresolvedImport
from... | StarcoderdataPython |
3376524 | <filename>CPI2/src/kmeans/kmeans.py
#
#
# Created by <NAME>, <NAME>, <NAME>, <NAME>
# EISTI, TIPE 2016 - 2017
#
# How to run : python3
# import kmeans
# kmeans.kmeans_rand(min,max,n,k) or kmeans.kmeans_file(file_n,k)
#
# What does it do : This program calculates the K-means of either random data sets, or from an input ... | StarcoderdataPython |
3201307 | # NeuroEvolution of Augmenting Topologies (NEAT) implementation in Python 3
# Created by <NAME>
# Feel free to modify, redistribute, and use this code as you wish.
# Credit is nice but not required!
# 9 - 16 - 2017
import random
import math
from datetime import datetime
random.seed(datetime.now())
#numero de neurons... | StarcoderdataPython |
4832790 | <reponame>chivandikwa/pulumi-aws
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequenc... | StarcoderdataPython |
4820578 | <filename>driver.py
# import download
import sys
import scipy.io as sio
import vesiclerf_feats
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import average_precision_score
import matplotlib.pyplot as plt
def main():
zSt... | StarcoderdataPython |
1759728 | <reponame>wang90063/MRO-Asyn-RL
import pygame
import sys
import random
import numpy as np
from pygame.locals import *
from constants import LOCAL_T_MAX
from collections import Counter
from math import exp
# 400 pixels represent the largest distance of the area, i.e. 100m
WINDOW_WIDTH = 400 # size of window's width i... | StarcoderdataPython |
3220688 | <filename>scripts/populate_database/populate_coinone.py
import json
import os
import sys
import pandas.io.sql as psql
import requests
crypto_tools_dir = os.getcwd().split('/scripts/')[0] + '/scripts/'
sys.path.append(crypto_tools_dir)
from crypto_tools import *
class PopulateCryptoCoinone(object):
"""
"""
... | StarcoderdataPython |
1709007 | <filename>setup.py<gh_stars>10-100
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as readme_file:
README = readme_file.read()
setup(
name="nepali-datetime",
version="1.0.7",
description="Datetime module that operates on top of Bikram Sambat Date & Nepal Time.",
... | StarcoderdataPython |
46087 | from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.interpolate import griddata
def fast_histogram2d(x, y, bins=10, weights=None, reduce_w=None, NULL=None,
reinterp=None):
"""
Compute the sparse bi-dimensional histogram of two data samples where *x... | StarcoderdataPython |
4832684 | <gh_stars>0
"""rename field json to detiail in db_activity
Revision ID: db728e1b5953
Revises: <PASSWORD>
Create Date: 2021-08-23 19:08:03.148175
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'db728e1b5953'
down_revisi... | StarcoderdataPython |
1771066 | # Python program to illustrate
# Pickle.dumps
import pickle
data = [ { 'a' :'A', 'b':2, 'c':3.0 }]
data_string = pickle.dumps(data)
print('PICKLE:', data_string) | StarcoderdataPython |
3330144 | # coding: utf-8
"""
Shutterstock API Reference
The Shutterstock API provides access to Shutterstock's library of media, as well as information about customers' accounts and the contributors that provide the media. # noqa: E501
OpenAPI spec version: 1.0.4
Generated by: https://github.com/swagger... | StarcoderdataPython |
94265 | <gh_stars>0
""" Genetic algorithm for feature selection """
import random
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_hastie_10_2
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import metrics
import numpy as np
import helpers as hp
import firebasemonitori... | StarcoderdataPython |
4827566 | <reponame>avinassh/kylo
import sys
import numpy as np
import torch
from settings import model_version
# monkey patch the path to infersent
if 'infersent' not in sys.path:
sys.path.insert(0, 'infersent')
from models import InferSent ## noqa
class GPUNotFoundException(Exception):
pass
def get_loaded_mod... | StarcoderdataPython |
13839 | <reponame>guangxu-li/leetcode-in-python
#
# @lc app=leetcode id=971 lang=python3
#
# [971] Flip Binary Tree To Match Preorder Traversal
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
#... | StarcoderdataPython |
1753432 | <gh_stars>1-10
## Script written by <NAME>.
## Last edited on 21/02/2020.
## BOSS-V algorithm.
# Copyright (c) 2020, the BOSS-V author (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE)
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import nquad
from itertools import pr... | StarcoderdataPython |
15111 | # Copyright 2016 Cisco Systems, 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | StarcoderdataPython |
1630339 | <reponame>joetainment/joecceasy
from joecceasy import Easy
Easy.Qtui.CreateApp().ExecWidget( Easy.Qtw.QLabel("Widget Made By One Liner") )
Easy.Qtui.CreateApp()
widget = Easy.Qtw.QPushButton("Widget Made Directly")
widget.setStyleSheet( 'font: 30pt sans')
Easy.Qtui.ExecWidget( widget )
def makeWidget():
glob... | StarcoderdataPython |
149425 | <reponame>osmanbaskaya/neural-wsd<gh_stars>0
from setuptools import find_packages
from setuptools import setup
setup(
name="neural-wsd",
packages=find_packages("neural_wsd"),
package_dir={"": "neural_wsd"},
author="<NAME>",
author_email="<EMAIL>",
version="0.0.1",
dependency_links=[],
i... | StarcoderdataPython |
1680710 | from django.utils import timezone
from rest_framework import serializers
from rest_framework.fields import CharField
from lego.apps.comments.serializers import CommentSerializer
from lego.apps.companies.models import (
Company,
CompanyContact,
CompanyFile,
CompanyInterest,
Semester,
SemesterSta... | StarcoderdataPython |
3344421 | <filename>ExportTable.py
class ExportTable:
"""
This class creates a table that holds dataframe data for query results and exporting
Attributes
----------
table_name : str
the table name of table in memory
export_table : Pandas.DataFrame
the dataframe of the SQL query result
... | StarcoderdataPython |
83893 | <gh_stars>100-1000
import torch
from torch import nn
from torchvision.models import vgg11, vgg16, resnet34
""" Code heavily adapted from ternaus robot-surgery-segmentation
https://github.com/ternaus/robot-surgery-segmentation """
class MultiClass_Resnet34(nn.Module):
def __init__(self, num_classes=1, num_filter... | StarcoderdataPython |
3256889 | """Tests for template tags of projects."""
import datetime
from django.test import TestCase
from ..templatetags import count, project_attributes
from geokey.users.models import User
from geokey.projects.models import Project
class CountTest(TestCase):
def test_more_link_text(self):
self.assertEqual(
... | StarcoderdataPython |
183808 | from django.contrib.auth.models import User
from django.db import models
# class Group(models.Model):
# name = models.CharField(max_length=10, unique=True)
#
# def __str__(self):
# return self.name
class Student(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
middl... | StarcoderdataPython |
1719559 | #!/usr/bin/env python
# -*- coding: utf-8 -*--
# Copyright (c) 2022 Oracle and its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
from typing import Any, Dict, Optional
def _extract_locals(
locals: Dict[str, Any], filter_out_nulls: Optional[b... | StarcoderdataPython |
3311457 | """Файл с тестами чтения событий из логах"""
from __future__ import annotations
from typing import List
import unittest
from core import EventsEmitter
TEST_ATYPE_0_LINE = r'T:0 AType:0 GDate:1941.11.10 GTime:9:55:21 MFile:Multiplayer/Dogfight\result2.msnbin MID: ' + \
r'GType:2 CNTRS:0:0,101:1,201:2 SETTS:11100... | StarcoderdataPython |
4801967 | <filename>utils/misc.py
def full_power(n):
"""
Функция нахождения нахождения наибольшей степени и основания для заданного числа
n = base ^ power : power --> max, base --> min
Parameters
----------
n : Union[gmpy2.mpz, int]
Число
Returns
-------
Tuple[int, Union[gmpy2.mpz, ... | StarcoderdataPython |
101624 | def flatten(aList):
myList = []
for el in aList:
if isinstance(el, list) or isinstance(el, tuple):
myList.extend(flatten(el))
else:
myList.append(el)
return myList
| StarcoderdataPython |
1799665 | # Generated by Django 2.2.15 on 2020-09-25 18:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("reporting", "0139_auto_20200925_1432")]
operations = [
migrations.RemoveField(model_name="azurecostentrylineitemdaily", name="offer_id"),
migrations.Remo... | StarcoderdataPython |
3389846 | <filename>src/organizer/urls.py<gh_stars>10-100
"""URL paths for Organizer App"""
from django.urls import path
from .views import (
NewsLinkCreate,
NewsLinkDelete,
NewsLinkDetail,
NewsLinkUpdate,
StartupCreate,
StartupDelete,
StartupDetail,
StartupList,
StartupUpdate,
TagCreate,... | StarcoderdataPython |
1762308 | from django.core.mail import EmailMessage
from StudentMailBenifits.settings import EMAIL_HOST_USER
def send_email_to_recipient(subject, message, recipient, fail_silently=True):
# message is in html
message = EmailMessage(subject=subject, body=message, from_email=EMAIL_HOST_USER, to=[recipient])
message.co... | StarcoderdataPython |
25228 | <reponame>carlosrjhoe/Python<gh_stars>0
def soma(x,y):
return print(x + y)
def sub(x,y):
return print(x - y)
def mult(x,y):
return print(x * y)
def div(x,y):
return print(x / y)
soma(3,8)
sub(10,5)
mult(3,9)
div(15,7) | StarcoderdataPython |
1723582 | from .event import Event
from .group import GroupItem
| StarcoderdataPython |
139319 | """ Cisco_IOS_XR_ip_tcp_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ip\-tcp package configuration.
This module contains definitions
for the following management objects\:
ip\-tcp\: Global IP TCP configuration
ip\: ip
Copyright (c) 2013\-2017 by Cisco Systems, Inc.
All rights rese... | StarcoderdataPython |
6237 | <gh_stars>1-10
import numpy as np
import torch
from . import common_utils
class ResidualCoder(object):
def __init__(self, code_size=7):
super().__init__()
self.code_size = code_size
@staticmethod
def encode_np(boxes, anchors):
"""
:param boxes: (N, 7 + ?) x, y, z, w, l, h,... | StarcoderdataPython |
3237242 | <reponame>kaczmarj/grand-challenge.org
from django.core.exceptions import SuspiciousFileOperation, ValidationError
from django.utils._os import safe_join
def validate_safe_path(value):
"""Ensures that the path is safe and normalised."""
base = "/input/"
try:
new_path = safe_join(base, value)
... | StarcoderdataPython |
6239 | import requests
import os
from PyInquirer import style_from_dict, Token, prompt
import sys
import utils.config as config
import utils.ends as ends
from utils.colorfy import *
from auto.testing import test_trans
import time
import json
style = style_from_dict({
Token.QuestionMark: '#E91E63 bold',
Token.Selected: '#673... | StarcoderdataPython |
4804162 | <gh_stars>0
# coding: utf-8
"""
This script can help you to summary the plink2 report file
"""
import os
import re
# reports_path = r"./"
# spec_cutoff = 3 # spectra number cut-off
# Best_evalue_cutoff = 2 # 交联位点对层次最好的e-value cutoff
# E_value_cutoff_SpecLvl = 2.0 # 谱图层次的e-value cutoff
# 对字典的key进行计数
def count_keyI... | StarcoderdataPython |
6 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "pos_kiosk"
app_title = "Pos Kiosk"
app_publisher = "9t9it"
app_description = "Kiosk App"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "<EMAIL>"
app_license = "MIT"
# Inclu... | StarcoderdataPython |
3399108 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: event.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflect... | StarcoderdataPython |
3220753 | <reponame>xavier630/pyrtf
#!/usr/bin/env python
import sys
import os.path
import pickle
from datetime import datetime
from adytum.util.sourceforge.base import login
# do a date check
filename, sfID, minDays, pickleFile = sys.argv[1:]
now = datetime.now()
minDays = int(minDays)
if os.path.exists(pickleFile):
fh = ... | StarcoderdataPython |
92898 | import copy
import errno
import os
import logging
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parallel import DistributedDataParallel
from .helper import TensorBoardWriter
from .linear_eval import iter_eval_epoch, linear_eval_online, linear_eval_offline
from data import... | StarcoderdataPython |
4835041 | import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simple_test
class OpenaccCudaCpp(rfm.RegressionTest):
def __init__(self):
super().__init__()
self.descr = 'test for OpenACC, CUDA, MPI, and C++'
self.valid_systems = ['daint:gpu', 'dom:gpu', 'tiger:gpu',
... | StarcoderdataPython |
1671045 | import re
import socket
import sys
import json
import utility
from commands import VirBotCommands
from logtype import VirBotLogType
from numerics import VirBotNumerics
def main(argv):
sentUser = False
sentNick = False
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((config["serve... | StarcoderdataPython |
1624676 | '''
Bonus Tutorial: Using SQLObject
This is a silly little contacts manager application intended to
demonstrate how to use SQLObject from within a CherryPy2 project. It
also shows how to use inline Cheetah templates.
SQLObject is an Object/Relational Mapper that allows you to access
data stored in an RDBMS in a pytho... | StarcoderdataPython |
1700274 | <gh_stars>0
import sqlite3
import discord
from discord.ext.commands import Cog, command, group, has_guild_permissions as has_perms
from asyncio import sleep
import random
from discord.ext import tasks
ROLE_ID = "YOUR_MEMBER_ID_ROLE_HERE"
class gatekeep(Cog, name="GateKeep"):
def __init__(self, bot):
self... | StarcoderdataPython |
1646798 | #!/usr/bin/python
import numpy as np
import cv2
import sys
import math
import argparse # Arguments parser
import os.path # check if file exists
INTERPOLATION = cv2.INTER_CUBIC
PCA_energy = .99
DEBUG = 1
GROUP_IMG_GRAY_FACES = "group_faces.jpeg"
SINGLE_IMG_GRAY_FACES = "single_faces.jpeg"
# Haar classifier cascade
H... | StarcoderdataPython |
32223 | # Unit Tests for the Enum Combo Box
import pytest
from logging import ERROR
from qtpy.QtCore import Slot, Qt
from ...widgets.enum_combo_box import PyDMEnumComboBox
from ... import data_plugins
# --------------------
# POSITIVE TEST CASES
# --------------------
def test_construct(qtbot):
"""
Test the const... | StarcoderdataPython |
4819551 | <filename>src/backend/marsha/core/tests/test_views_lti_config.py<gh_stars>0
"""Test LTI xml configuration views in the ``core`` app of the Marsha project."""
from django.test import TestCase, override_settings
import xmltodict
# We don't enforce arguments documentation in tests
# pylint: disable=unused-argument
cl... | StarcoderdataPython |
186974 | # coding: utf-8
"""
Task Execution Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import... | StarcoderdataPython |
1716330 | """Classification using random forest."""
import logging
import pickle
import numpy as np
from sklearn.ensemble import RandomForestClassifier
logger = logging.getLogger(__name__)
class RandomForest:
"""Train or classify using a RandomForest model."""
def __init__(self, num_features, model=None):
"""... | StarcoderdataPython |
1670163 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import sorl.thumbnail.fields
import filmfestival.models
class Migration(migrations.Migration):
dependencies = [
('filmfestival', '0008_film_coming'),
]
operations = [
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.