id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
30473 | from utils import constants as const
print(const.PATH)
| StarcoderdataPython |
3292631 | <reponame>adadonder/DirForcer
#!/usr/bin/env python3
import argparse
import queue
import sys
import threading
import urllib.error
import urllib.parse
import urllib.request
sys.exit("Use the -h parameter to learn about using the program.") if len(sys.argv[1:]) == 0 else True
description = "DirForcer is a brute-forcin... | StarcoderdataPython |
1646471 | from .data import DiscoverMatrix, row_stack
from .grouptest import groupwise_discover_test
from .pairwise import pairwise_discover_test
__version__ = "0.9.4"
| StarcoderdataPython |
3297299 | #coding:utf8
def read_problem(src):
# lines = src.strip('\n').split(';')
# board = [ map(lambda s: int(s) ,lsrc) for lsrc in lines]
board = map(lambda s: int(s) ,src.strip('\n').replace(';',''))
return board
def lc_index(line, col):
return line * 9 + col
def index_lc(index):
return int(index ... | StarcoderdataPython |
3397466 | <filename>admin_app/router_utils.py
import paramiko
import os
import sys
import requests
import threading
from threading import Thread
import time
import getpass
import color
# from color import p
from kivy.clock import mainthread
# Class to detect and manage secure sync boxes
class SyncBoxes:
# How long to wait ... | StarcoderdataPython |
172001 | from minos.common.testing import (
MockedDatabaseClient,
)
from minos.networks import (
BrokerPublisherQueueDatabaseOperationFactory,
)
from ..collections import (
MockedBrokerQueueDatabaseOperationFactory,
)
class MockedBrokerPublisherQueueDatabaseOperationFactory(
BrokerPublisherQueueDatabaseOperat... | StarcoderdataPython |
3374393 | from PySide6.QtCore import QLine, QPoint, Qt, QTimer, Slot, Signal
from PySide6.QtWidgets import QApplication, QWidget, QFrame
from PySide6.QtGui import QPainter
from PySide6 import QtGui
import math
class Line(QLine):
def length(self):
return (self.dx()**2 + self.dy()**2)**.5
class ImageW(QWidget):
... | StarcoderdataPython |
3345732 | # Generated by Django 2.1.11 on 2019-09-03 19:45
from django.db import migrations
from django.utils import timezone
def set_all_null_timestamps_to_now(apps, schema_editor):
DungeonLog = apps.get_model('data_log', 'DungeonLog')
RiftRaidLog = apps.get_model('data_log', 'RiftRaidLog')
WorldBossLog = apps.ge... | StarcoderdataPython |
3358391 | <reponame>white-lab/fc-cycle<filename>setup.py
import os
from setuptools import setup, find_packages
__dir__ = os.path.dirname(__file__)
with open(
os.path.join(__dir__, "fc_cycle", "__init__.py")
) as f:
__version__ = "0.0.0"
for line in f:
if "#" in line:
line = line[:line.index("#... | StarcoderdataPython |
1606372 | <filename>src/tests/test_main.py
from workout_bot.main import extract_dailydare_url
from workout_bot.main import extract_wod_url
# Please note, that the following tests are just smoke tests in order
# to start testing.
# Yes, they rely on a website which is not under my control.
# Yes, I know, this is not good.
# This... | StarcoderdataPython |
169825 | <gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
"""
copyright (c) 2016-2018 Earth Advantage. All rights reserved.
..codeauthor::<NAME> <<EMAIL>>
"""
from __future__ import absolute_import, unicode_literals
# Imports from Standard Library
import unittest
# Imports from Django
from django.core.exceptions import... | StarcoderdataPython |
48261 | <reponame>kirov/ephim
import os
from .library import Library
def main():
location = Library.find_library(os.getcwd())
library = Library(location)
library.organize_all()
if __name__ == '__main__':
main()
| StarcoderdataPython |
1651986 | <reponame>mihaivavram/twitterbots
from __future__ import absolute_import, print_function
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler, Stream, API
from queue import Queue
from collection.tweets import extract_users
import os
import json
import logging
import time
logger = logging.getL... | StarcoderdataPython |
4825477 | import os
import pickle
import shutil
from pathlib import Path
import numpy as np
from external.util import sklearn_forest_to_xgboost_json, sklearn_booster_to_xgboost_json
def read_file(filename):
with open(filename, 'r') as file:
return file.read()
def write_file(filename, contents):
with open(fi... | StarcoderdataPython |
1707370 | <filename>python/array/169.majority-element.py
# Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.
# You may assume that the array is non-empty and the majority element always exist in the array.
# Example 1:
# Input: [3,2,3]
# Output: 3
# ... | StarcoderdataPython |
174762 | from quiz import app
| StarcoderdataPython |
187934 | from datetime import datetime
import pytz
import json
WIB = pytz.timezone('Asia/Jakarta')
time_now = datetime.now(WIB)
time_input = input('input time: ')
time_hours = time_input[0:].split(':')[0]
time_minutes = time_input[0:].split(':')[1]
time_seconds = time_input[0:].split(':')[2]
# time_custom = '{"hours": {}, "... | StarcoderdataPython |
3269673 | import flask
import os
static_dir = 'reports'
def render(filename):
sdir = f'{static_dir}/'
return flask.send_from_directory(sdir, filename) | StarcoderdataPython |
3221698 | import sal.plugin
TITLES = {'ok': 'Machines with less than 80% disk utilization',
'warning': 'Machines with 80%-90% disk utilization',
'alert': 'Machines with more than 90% disk utilization'}
class DiskSpace(sal.plugin.Widget):
description = 'Available disk space'
template = 'plugins/tr... | StarcoderdataPython |
3226475 | from django_cradmin.viewhelpers.listbuilder import base
class RowList(base.List):
def get_test_css_class_suffixes_list(self):
css_class_suffixes = super(RowList, self).get_test_css_class_suffixes_list()
css_class_suffixes.append('cradmin-listbuilder-list')
return css_class_suffixes
de... | StarcoderdataPython |
3294076 | <gh_stars>0
import datetime as datetime
import DataFlow.DataDestination.constants as destination_constants
import DataFlow.DataDestination.controller as destination_controller
import DataFlow.DataSource.controller as data_source_controller
import DataFlow.Descriptor.constants as descriptor_constants
import DataFlow.Tr... | StarcoderdataPython |
44853 | import math
def rototranslate(x0, y0, angle):
alpha = float(angle)*math.pi/180.0
cos = math.cos
sin = math.sin
def RT(x, y):
return x0+x*cos(alpha)-y*sin(alpha),y0+x*sin(alpha)+y*cos(alpha)
return RT
def inverseRT(x0, y0, angle):
alpha = float(angle)*math.pi/180.0
cos = math.cos
sin = math.sin
def iRT(... | StarcoderdataPython |
119787 | <gh_stars>1-10
# Author: <NAME>
# License: MIT
# Version: 0.1.0
"""
Part of VISFBPIC.
Contains methods for creating static visualisations of the FBPIC data.
"""
import os
import sys
import importlib.util
import numpy as np
import matplotlib.pyplot as plt
plt.style.use(os.path.join(
os.path.split(__file__)[0], '_m... | StarcoderdataPython |
145980 | import inflection
from sqlalchemy import text, DDL, event
from sqlalchemy.dialects.postgresql import UUID, ENUM
from flaskplus.extensions import db
Col = db.Column
def get_enum_from_namedtuple(namedtuple_):
name = inflection.underscore(namedtuple_.__class__.__name__)
return ENUM(*namedtuple_._fields, name=na... | StarcoderdataPython |
4831001 | <filename>nicos_jcns/galaxi/setups/detectors.py
# -*- coding: utf-8 -*-
description = 'GALAXI Mythen and Pilatus detector setup'
group = 'optional'
display_order = 10
includes = ['absorber', 'jcns_io', 'jcns_mot', 'pindiodes']
tango_base = 'tango://phys.galaxi.kfa-juelich.de:10000/galaxi/'
sysconfig = dict(datasi... | StarcoderdataPython |
3386475 | print("Hello World")
print ("Bye")
x= 4
y = 5
print(x + y)
| StarcoderdataPython |
1763752 | <reponame>nichitaa/multi-threaded-restaurant-simulation
import time
import consts
import random
import logging
import requests
import threading
logger = logging.getLogger(__name__)
class Waiters:
def __init__(self, dh, i):
self.name = f'{dh.name} Waiter-{i}'
self.dh = dh
self.id = i
... | StarcoderdataPython |
57578 | <gh_stars>0
from __future__ import unicode_literals
from django.db import models
class Node(models.Model):
node_name=models.CharField(max_length=100)
description=models.CharField(max_length=100)
def __str__(self):
return "{}:{}:{}".format(self.id, self.node_name, self.description)
class Record(models.Model):
c... | StarcoderdataPython |
3293459 | from modules import engine
from modules import out
from modules import transfer
from modules import sync
@engine.prepare_and_clean
def execute(mode = None):
if mode is None:
mode = 'sync'
out.log("synchronizing local files (" + mode + " mode)...")
if mode == 'mirror':
sync.download(True, T... | StarcoderdataPython |
73711 | <reponame>1Maxnet1/opbasm
'''Main Opbasm package'''
from opbasm import *
| StarcoderdataPython |
156737 | <filename>oi/Contest/self/NOIP2017-Virtual-Test/day2/zip/data/sequence/gen.py
#!/usr/bin/env pypy
from random import *
from sys import *
n, allzero = map(int, argv[1:])
if allzero:
print '.' * n
else:
print "".join([choice(['.'] * 5 + ['1', '0']) for i in xrange(n)])
| StarcoderdataPython |
71961 | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from typing import Iterable, List, Mapping, Optional, Tuple, Union
import popart._internal.ir as _ir
from popart.ir.context import get_current_context, op_debug_context
from popart.ir.graph import Graph
from popart.ir.tensor import Tensor
from .utils import che... | StarcoderdataPython |
98546 | import logging
import sys
class Configuration(dict):
def __getattr__(self, name):
if name in self:
return self[name]
else:
raise AttributeError("No such config attribute get: " + name)
def __setattr__(self, name, value):
self[name] = value
def __delattr__(... | StarcoderdataPython |
1652431 | import sqlite3
import pytest
from dbapi3 import Database
def test_connection():
db = Database(sqlite3, ':memory:')
db.c.close()
def test_create_table():
db = Database(sqlite3, ':memory:')
db.execute('create table teste(teste varchar(10))').c.commit()
db.c.close()
def test_create_table_fail():
... | StarcoderdataPython |
15132 | from django.contrib import admin
from .models import Chat
class ChatAdmin(admin.ModelAdmin):
list_display = ("pk",)
admin.site.register(Chat, ChatAdmin)
| StarcoderdataPython |
4800396 | <reponame>iogf/django-paybills
from django.apps import AppConfig
class PaybillsAppConfig(AppConfig):
name = 'paybills'
| StarcoderdataPython |
136796 | # -*- coding:utf-8 -*-
import numpy as np
def dropout(x, level):
if level < 0 or level >= 1:
raise ValueError("Dropout Level must be in interval[0, 1)")
retain_prob = 1. - level
random_tensor = np.random.binomial(n = 1, p = retain_prob, size = x.shape)
print(random_tensor)
x *= random_te... | StarcoderdataPython |
1649919 | <gh_stars>0
# -*- coding: utf-8 -*-
known_chains = {
"GPH": {
"chain_id": "8d1be24270faee1bf531398c9b77c313956dbc9607f6b873e23ff62840786c07",
"core_symbol": "KES",
"prefix": "KES",
},
}
| StarcoderdataPython |
1691224 | <reponame>LarryJiang134/PyTorch-sample
import torch
from yolo.utils import convert2cpu
def parse_cfg(cfg_file):
"""
Takes a configuration file
Returns a list of blocks. Each blocks describes a block in the neural
network to be built. Block is represented as a dictionary in the list
"""
file = ... | StarcoderdataPython |
146169 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import fvcore.nn.weight_init as weight_init
import torch
from detectron2.layers import Conv2d, ConvTranspose2d, get_norm
from torch import nn
from torch.nn import functional as F
##
from shapenet.modeling.models.encoder_modified import Encoder
#from... | StarcoderdataPython |
1716357 | """nyuuuspace URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | StarcoderdataPython |
3379938 | from empyrial import fundlens, Engine
portfolio = Engine(
start_date= "2020-06-09",
portfolio= ["BABA", "RELIANCE.NS", "KO", "^DJI","^IXIC"]
)
fundlens(portfolio)
| StarcoderdataPython |
4836945 | <reponame>starkyller/dissertacao
from rest_framework import generics
# from rest_framework.authentication import TokenAuthentication, SessionAuthentication
# from rest_framework.permissions import IsAuthenticated, DjangoModelPermissions
from apps.users.models import Patient
from ..models import (
UserSolutions,
... | StarcoderdataPython |
3389322 | <filename>cyclone.py
# coding=utf-8
__author__ = 'wes'
from tornado.web import FallbackHandler
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
from flask_main import app
from sockjs.tornado import SockJSRouter, SockJSConnection
from app_wrap import Application
class AsyncConnection(SockJSConne... | StarcoderdataPython |
36140 | from marshmallow import (fields, post_load, Schema, validate, validates,
validates_schema, ValidationError)
from {{cookiecutter.project_slug}}.lib.hash import compare_plaintext_to_hash, hash_plaintext
from {{cookiecutter.project_slug}}.models.user import User, get_user_by_email_address
MIN_PA... | StarcoderdataPython |
1684666 | <filename>Main/main.py
# Copyright (c) 2019 <NAME> (<EMAIL>)
# Estudo dirigido ao uso da biblioteca Tkinter no Python
from tkinter import *
from tkinter import messagebox
from time import strftime
class api (object):
#Padrão para criação de GUI
def __init__(self,window):
self.window=window
sel... | StarcoderdataPython |
3203341 | bank_dataset = {
'age': [59, 56, 41, 55, 54, 42, 56, 60, 37, 28],
'job': ['admin.', 'admin.', 'technician', 'services', 'admin.', 'management', 'management', 'retired', 'technician', 'services'],
'marital': ['married', 'married', 'married', 'married', 'married', 'single', 'married', 'divorced', 'married', '... | StarcoderdataPython |
166366 | from elasticsearch import Elasticsearch
es = Elasticsearch(
hosts = [{'host': 'es-domain.es.amazonaws.com', 'port': 443}],
use_ssl=True, verify_certs=True
)
document = {"name": "ruan", "surname": "bekker"}
response = es.index(index='my-index', doc_type='_doc', body=document)
# response
# {'_index': 'my-ind... | StarcoderdataPython |
21051 | <reponame>rsanchezgarc/BIPSPI<filename>trainAndTest/processOneFold_sm.py
from __future__ import print_function
import itertools
import sys, os
import inspect
import numpy as np
from joblib import load as joblib_load
from .resultsManager import ResultsManager
#from .classifiers.randomForest import trainMethod, predict... | StarcoderdataPython |
172909 | #!/usr/bin/env python
import argparse
import trimesh
from tqdm import tqdm
from ll4ma_util import file_util, ui_util
if __name__ == '__main__':
"""
Simple mesh conversion script using Trimesh https://trimsh.org/index.html.
Right now this assumes you want to convert all files in a directory with a
pa... | StarcoderdataPython |
3379730 | from mojo.roboFont import CurrentFont
from glyphConstructionController import GlyphBuilderController
GlyphBuilderController(CurrentFont())
| StarcoderdataPython |
44789 | <gh_stars>0
#Albert GCN Transform train
import argparse
import dill as pickle
from torchtext.datasets import TranslationDataset
from torchtext.data import Field, Dataset, BucketIterator
import transpytorch.transformer.Constants as Constants
import os
import re
import json
from tqdm import tqdm, trange
import pdb
impor... | StarcoderdataPython |
1727912 | <filename>watchlist_backend/mediaItem/api/urls.py
"""
Urls for mediaItem.
"""
from rest_framework import routers
from .views import wantToWatchMediaItemViewSet, haveWatchedMediaItemViewSet
router = routers.DefaultRouter()
router.register('wantToWatch', wantToWatchMediaItemViewSet, 'wantToWatch')
router.register('hav... | StarcoderdataPython |
1720561 | <reponame>baby5/HackerRank<filename>DataStructures/Heap/Median.py<gh_stars>0
#coding:utf-8
import heapq as heapq_min
#大小顶堆,0.55s
#如果都是正值,可以用小顶堆保存负值来实现大顶堆
class Heapq_max(object):
def heappush(self, heap, item):
i = len(heap)
heap.append(None)
while i > 0 and heap[(i-1)/2] < item:
... | StarcoderdataPython |
3214423 | #!/usr/bin/env python
from flask import Flask, jsonify, request, render_template, abort
from textblob import TextBlob, Word, Blobber
from textblob.classifiers import NaiveBayesClassifier
from textblob.taggers import NLTKTagger
#from textutils import strip_punc
from textblob.utils import strip_punc
from textblob import ... | StarcoderdataPython |
1734750 | def find_missing_number(numbers):
diff = set(range(1, len(numbers) + 2)) - set(numbers)
return diff.pop() | StarcoderdataPython |
168092 | <reponame>wingedsheep/music-generation-tools
import pretty_midi
from mgt.datamanagers.time_shift.event_extractor import Event
class MidiGenerator(object):
@classmethod
def events_to_midi(cls, events: [Event], starting_tempo=120) -> pretty_midi.PrettyMIDI:
midi = pretty_midi.PrettyMIDI()
even... | StarcoderdataPython |
23218 | <filename>src/lib/libpasteurize/fixes/fix_newstyle.py<gh_stars>10-100
u"""
Fixer for "class Foo: ..." -> "class Foo(object): ..."
"""
from lib2to3 import fixer_base
from lib2to3.fixer_util import LParen, RParen, Name
from libfuturize.fixer_util import touch_import_top
def insert_object(node, idx):
node.insert_c... | StarcoderdataPython |
20644 | # 获取学生所有的挑战题目信息
# 包括时间、结果、代码等
# 写入数据库stuoj的stuquestionbh表中
from selenium import webdriver
# from selenium.webdriver.common.by import By
import pymysql
import re
from bs4 import BeautifulSoup
import connsql
# import loginzznuoj
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support impo... | StarcoderdataPython |
3293124 | <reponame>dougbrion/ModernGL<filename>moderngl/experimental/vertex_array.py
from typing import Any
from .buffer import Buffer
from .program import Program
from .scope import Scope
class VertexArray:
__slots__ = ['__mglo', '__ibo', 'program', 'scope', 'mode', 'vertices', 'extra']
def __init__(self):
... | StarcoderdataPython |
3223146 | <filename>nx/__init__.py<gh_stars>0
#!/usr/bin/python3
from nx import classes as pc
import json
from string import ascii_letters, digits
from random import choice
import copy
import operator
from functools import reduce
def from_file_to_cy(
classes_dict, session
) -> dict():
"""
A (valid) json file i... | StarcoderdataPython |
1723030 | <filename>stargan/train.py
import os
import time
import tensorflow as tf # TF 2.0
from glob import glob
import numpy as np
import cv2
from model import Generator, Discriminator
from utils import generator_loss, discriminator_loss, save_imgs, preprocess_data
from utils import domain_classification_loss, reconstrutio... | StarcoderdataPython |
3304040 | <reponame>Mikma03/InfoShareacademy_Python_Courses<filename>Part_2_intermediate/mod_2/lesson_4/homework_3/shop/order_element.py
class OrderElement:
def __init__(self, product, quantity):
self.product = product
self.quantity = quantity
def calculate_price(self):
return self.product.unit_... | StarcoderdataPython |
3239922 | <filename>moztrap/view/api/urls.py
from django.conf.urls.defaults import patterns, url, include
from tastypie.api import Api
from moztrap.model.core import api as core
from moztrap.model.environments import api as environments
from moztrap.model.execution import api as execution
from moztrap.model.library import api ... | StarcoderdataPython |
1769907 | <filename>sd_material_ui/Stepper.py
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Stepper(Component):
"""A Stepper component.
Material UI Stepper component
Keyword arguments:
- activeStep (number; default 0): Set the active step (zero based in... | StarcoderdataPython |
1716367 | import pickle
import nltk
import numpy as np
import torch
import os
import copy
from IRNet.preprocess import utils
from src.rule import semQL
from api.adapters.IRNet.constants import PATH_TO_CONCEPTNET
from api.paths import SCHEMAS_DIR
from api.setup_util import schemas, no_stdout
from IRNet.sem2SQL import transform
f... | StarcoderdataPython |
3246821 | <reponame>TheSecEng/sublime-plugin
import unittest, sublime
from ..phantoms import add_see_results_phantom
class TestPhantoms(unittest.TestCase):
def setUp(self):
# do something before running the test suite
print(sublime.active_window())
pass
def test_1(self):
panel = sublim... | StarcoderdataPython |
3205562 | <gh_stars>0
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='pymain',
version='1.0.0',
description='Simple package to make a "Main" similar to C',
long_description=readme,
author='<NAM... | StarcoderdataPython |
1641470 | <reponame>Staberinde/data-hub-api
# Generated by Django 3.1.8 on 2021-05-27 10:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0111_add_telephone_validation'),
('interaction', '0075_add_trade_agreement_fields'),
]
operatio... | StarcoderdataPython |
3396793 | <filename>9.tcga-classify/classify-cancer-types.py
"""
2018 <NAME>
9.tcga-classify/classify-cancer-types.py
Predicting 33 different cancer-types using elastic net logistic regression and
compressed gene expression features in TCGA PanCanAtlas
Usage:
python classify-cancer-types.py
Output:
Cancer-type specific D... | StarcoderdataPython |
1604477 | # Copyright 2011,2012 <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 agreed to in writing,... | StarcoderdataPython |
1797183 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 20:03:08 2022
@author: <NAME>
"""
import h5py
import numpy as np
LONG = "feats-LoFTR-r1024_matches-loftr_pairs-netvlad.h5"
SHORT = 'feats-LoFTR-r1024.h5'
def update_two_h5_files(filename_short = SHORT, filename_long = LONG):
print(filename_short,f... | StarcoderdataPython |
3237547 | """channelmgnt.py - Sopel Channel Management Plugin."""
import re
import time
from MirahezeBots_jsonparser import jsonparser as jp
from sopel import formatting
from sopel.config.types import StaticSection, ValidatedAttribute
from sopel.plugin import (
OP, commands, event, example, priority, require_admin, requir... | StarcoderdataPython |
142695 | import nltk
class Analyzer():
"""Implements sentiment analysis."""
def __init__(self, positives, negatives):
"""Initialize Analyzer."""
self.negatives=[]
self.positives=[]
with open ("negative-words.txt") as negative:
for line in negative:
... | StarcoderdataPython |
281 | """Methods for working with ontologies and the OLS."""
from urllib.parse import quote_plus
import requests
OLS_API_ROOT = "http://www.ebi.ac.uk/ols/api"
# Curie means something like CL:0000001
def _ontology_name(curie):
"""Get the name of the ontology from the curie, CL or UBERON for example."""
return cur... | StarcoderdataPython |
75047 | import re
import sys
sys.path.append("../../../..")
from text import *
#import importlib
#import os
#import pdb
#----------------------------------------------------------------------------------------------------
text = Text("../../../../testData/harryMosesDaylight/daylight_1_4.eaf",
"../../../../testData/... | StarcoderdataPython |
3317592 | <filename>models/generator.py<gh_stars>0
import torch
import torch.nn as nn
import math
from .utils import InstanceNorm, AdaInstanceNorm
class ResConv(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size):
super(ResConv, self).__init__()
padding = kernel_size // 2
self.pad1 = nn.Re... | StarcoderdataPython |
3351938 | <reponame>ajmal017/amp
import io
import logging
import numpy as np
import pandas as pd
import core.artificial_signal_generators as casgen
import core.config as cconfig
import core.dataflow.nodes.test.helpers as cdnth
import core.dataflow.nodes.transformers as cdnt
import helpers.unit_test as hut
_LOG = logging.getLo... | StarcoderdataPython |
1610181 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkpotentialfit.py,v $
## Language: Python
## Date: $Date: 2005/09/14 09:51:28 $
## Version: $Revision: 1.5 $
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHO... | StarcoderdataPython |
112007 | import PIL
import markdown
from django.db import models
from django.utils.text import slugify
# $1 USD in other currencies
TO_USD = {
"EUR": 0.82,
"SGD": 1.33,
"AUD": 1.3,
"USD": 1.0,
"RMB": 6.48,
"INR": 73.0,
"GBP": 0.73,
"CHF": 0.89,
"HKD": 7.75,
"CAD": 1.27
}
CURRENCY_SYMBOL... | StarcoderdataPython |
1623288 | <gh_stars>1-10
#!/usr/bin/env python
"""
This is a program to synchronize a PHPIPAM server with addresses (hosts)
from multiple sources being:
- Cisco DNA Center
- Microsoft DHCP Server
- Cisco DHCP Server running on Cisco IOS switch
- Static hosts defined in a CSV file
PHPIPAM is a free open source IP Address Managem... | StarcoderdataPython |
69099 | <gh_stars>10-100
# Copyright 2017 - RoboDK Software S.L. - http://www.robodk.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/LICENSE-2.0
# Unless requ... | StarcoderdataPython |
4837898 | <filename>src/f0cal/core/__main__.py<gh_stars>0
#PYTHON_ARGCOMPLETE_OK
import plugnparse
import f0cal.core
@plugnparse.modifier([])
def _top_level_args(parser):
# # parser.add_argument("-f0d", "--f0cal-debug", default=None, action='store_const', const="DEBUG")
# parser.add_argument(
# "-c", "--config",... | StarcoderdataPython |
68898 | import os
from pprint import pprint
import requests
from flask import Flask, request
from flask.views import MethodView
from config import setting
from models import User
from apps import hitcon_zeroday
app = Flask(__name__)
class BotCommand:
def parse(self, dict_data):
if dict_data["text"] == "/start... | StarcoderdataPython |
4829387 | <filename>var/spack/repos/builtin/packages/lcals/package.py<gh_stars>1-10
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import platform
class Lca... | StarcoderdataPython |
3314427 | from .models import (
FreeWaterTensorModel,
NODDIModel,
BallStickModel
)
__all__ = ["FreeWaterTensorModel", "NODDIModel", "BallStickModel"]
| StarcoderdataPython |
135104 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import ABC
from asyncio import sleep
from copy import Error
from http import HTTPStatus
from typing import Awaitable, Callable, List, Union
from botbuilder.core.invoke_response import InvokeResponse
from botbuilder... | StarcoderdataPython |
3288795 | <filename>modules/_analytic.py
"""
Module containing functions for calculating analytic solution of potential and
eigenvalues for the infinite and finite potential well and for the harmonic
oscillator.
"""
import os.path
import numpy as np
def _potential_inifinite_potwell():
"""Calcultes the potential for the in... | StarcoderdataPython |
3358378 | <reponame>contraslash/static_html_engine-django
from clubguiasfarallones import conf as static_html_conf
NAMESPACE = static_html_conf.STATIC_HTML_ENGINE_NAMESPACE
CREATE_HTML_URL_NAME = "static_html_create"
DETAIL_HTML_URL_NAME = "static_html_detail"
EDIT_HTML_URL_NAME = "static_html_edit"
LIST_HTML_URL_NAME = "stati... | StarcoderdataPython |
3397753 | <reponame>iamflowting/umc-web-scraper
# -*- coding: utf-8 -*-
"""
Unfortunate Maps Catalogue Webscraper v1.2.
@author: iamflowting
@created-on: 12/09/20
@last-updated: 03/12/20
"""
import requests
from bs4 import BeautifulSoup
import time
import gspread
from oauth2client.service_account import ServiceAccountCredenti... | StarcoderdataPython |
4819783 | # -*- coding: utf-8 -*-
import sys
PY2 = sys.version_info[0] == 2
_identity = lambda x: x
if not PY2:
unicode_type = str
basestring_type = str
text_type = str
string_types = (str,)
integer_types = (int,)
iterkeys = lambda d: iter(d.keys())
itervalues = lambda d: iter(d.values())
it... | StarcoderdataPython |
1706369 | import json
import requests
try:
response = requests.get("https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_recommendations")
response.raise_for_status()
data=response.json()
print(data[0]['hostname'])
except requests.exceptions.HTTPError as error:
print(error.response.status_code, error.r... | StarcoderdataPython |
3243796 | print ("teste")
| StarcoderdataPython |
1679877 | <reponame>tsbxmw/leetcode
# 178. 分数排名
# SQL架构
# 编写一个 SQL 查询来实现分数排名。如果两个分数相同,则两个分数排名(Rank)相同。请注意,平分后的下一个名次应该是下一个连续的整数值。换句话说,名次之间不应该有“间隔”。
# +----+-------+
# | Id | Score |
# +----+-------+
# | 1 | 3.50 |
# | 2 | 3.65 |
# | 3 | 4.00 |
# | 4 | 3.85 |
# | 5 | 4.00 |
# | 6 | 3.65 |
# +----+-------+... | StarcoderdataPython |
38583 | <gh_stars>0
from B3LOB import Lob
import numpy as np
import os
from datetime import datetime
import matplotlib.pyplot as plt
lob = Lob(datadir='/home/eduardo/MarketData/')
fnames = ['OFER_CPA_20191127.gz', 'OFER_VDA_20191127.gz']
lob.read_orders_from_files('PETR3', fnames)
lob.set_snapshot_freq(60)
lob.process_orders(... | StarcoderdataPython |
3201072 |
from flask import Flask
from gevent.pywsgi import WSGIServer
from gevent import monkey
# from _thread import get_ident
from greenlet import getcurrent as get_ident
import time
monkey.patch_all()
app=Flask(__name__)
@app.route("/")
def hello_world():
print(get_ident())
time.sleep(10)
return "hello worl... | StarcoderdataPython |
1746262 | <filename>tests/bot/test_utils.py
from django.conf import settings
from django.test import TestCase, override_settings
from faker.proxy import Faker
from bot.exceptions import DiscordApiException
from bot.utils import discord_api_get, discord_api_patch, discord_api_post
from tests.bot.helpers.constants import (CHANNEL... | StarcoderdataPython |
3386214 | """Logic"""
import yaml
import ics
import requests
from glom import glom
def get_event_sources():
with open("sources.yml") as f:
sources = list(yaml.load_all(f))
return sources
def get_aggregated_ical(sources):
aggregated_calendar = ics.Calendar()
for ics_url in glom(sources, ["ics_url"]):
... | StarcoderdataPython |
115486 | import json
from collections import namedtuple
import aiohttp
import voluptuous as vol
class InverterError(Exception):
"""Indicates error communicating with inverter"""
class DiscoveryError(Exception):
"""Raised when unable to discover inverter"""
InverterResponse = namedtuple('InverterResponse',
... | StarcoderdataPython |
3385154 | <gh_stars>0
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.