blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
69
license_type
stringclasses
2 values
repo_name
stringlengths
5
118
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
63
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
2.91k
686M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
213 values
src_encoding
stringclasses
30 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
2
10.3M
extension
stringclasses
246 values
content
stringlengths
2
10.3M
authors
listlengths
1
1
author_id
stringlengths
0
212
3c67a4b9cc2936a7735c731d515fa2157533c963
9bc93942dd89dcac95b5216a7bb70bf530e29236
/pythonAlgo/DFS&BFS/등산경로.py
240f7b03a8c86a9c4ef5479ac55bdf61ece999c8
[]
no_license
zbqlr456/zbqlr456
65edccef49f63fa72d98aa58105b87797465a157
8b5811d8e7a9f7d3c28cb12450ae69c0ed44216b
refs/heads/main
2022-12-25T06:11:10.931084
2022-12-13T06:55:15
2022-12-13T06:55:15
252,738,892
0
0
null
null
null
null
UTF-8
Python
false
false
893
py
import sys di = [-1, 1, 0, 0] dj = [0, 0, -1, 1] def DFS(x,y): global cnt if x == end[0] and y == end[1]: cnt += 1 else: for d in range(4): nexti = x + di[d] nextj = y + dj[d] if 0 <= nexti < n and 0 <= nextj < n and g[nexti][nextj] > g[x][y]: DFS(nexti,nextj) if __name__ == "__main__": n = int(input()) g = [[] for _ in range(n)] for i in range(n): g[i] = list(map(int,input().split())) start = [0,0,1e9] end = [0,0,-1e9] for i in range(n): for j in range(n): if g[i][j] < start[2]: start[0] = i start[1] = j start[2] = g[i][j] if g[i][j] > end[2]: end[0] = i end[1] = j end[2] = g[i][j] cnt = 0 DFS(start[0],start[1]) print(cnt)
[ "zbqlr456@naver.com" ]
zbqlr456@naver.com
d1ede18d2d2e4505c05518905e58bd32ee7fa1e2
0a1d48a2b740b5bd74505f2b392b92f56f99f880
/app.py
634594cf9fcaf5fc74cfe9c90b9814278995ac31
[]
no_license
sarahoeri/Giraffe
4dde173b42665250c51cd4f86e2404e4ade7b5d9
283b44714f07509879392b1455416df5ee246c51
refs/heads/master
2020-12-20T08:07:40.583411
2020-01-27T13:28:21
2020-01-27T13:28:21
236,009,706
0
0
null
null
null
null
UTF-8
Python
false
false
894
py
# Variables character_name = "John" character_age = "50" isMale = True print("there was once a man called " + character_name) print("he was at an age of " + character_age) # Functions phrase = "Giraffe Academy" print(phrase + " is developed now") print(phrase.upper()) print(phrase.lower()) print(phrase.isupper()) print(phrase.upper().isupper()) print(len(phrase)) print(phrase[9]) print(phrase.index("raffe")) print(phrase.replace("Academy", "School")) # Numbers print(5 * (4 +5)) myNum = 10 print(str(myNum) + " is my favourite number") my_number = -0.54 print(abs(my_number)) print(pow(10, 8)) # to find max and min values print(max(27, 88, 73, 109)) print(round(3.9)) from math import * print(floor(9.5)) print(ceil(7.2)) print(sqrt(36)) # getting input from users name = input("Enter your name: ") age = input("Enter your age: ") print("Heeey " + name + "!" " You are " + age)
[ "oerisarah@gmail.com" ]
oerisarah@gmail.com
5ba9e377fc2b1c5b3775045e195f5149da9627d2
8d14d526969d8e970254f08563ff2c6e6583dd35
/Python/2019/ClassOrnek/kullanici.py
235c35cfc5458e2c5b66ae4511e018339c8b2338
[]
no_license
osmanraifgunes/MedipolCodes
c29db62896162c4b1a2c8c274877fff63149f826
943b014269e9a7b529e74741ce14447dbd7d5df5
refs/heads/master
2023-01-09T10:31:02.907945
2020-06-09T18:05:04
2020-06-09T18:05:04
218,612,787
6
13
null
2023-01-07T18:58:55
2019-10-30T19:59:16
Python
UTF-8
Python
false
false
546
py
import tkinter as tk import Ornek orn = Ornek.deneme2() """print (type(orn)) print (orn.acilis)""" #orn.globalOzellik3 = 123 print (orn.globalOzellikGetter) #print (orn.globalOzellik3) #print (Ornek.deneme2.globalOzellik) def topla(sayi1,sayi2): return sayi1 + sayi2 orn.globalOzellikSetter = topla(5,55) print (orn.globalOzellikGetter) pencere = tk.Tk() pencere.geometry('200x70') etiket = tk.Label(text='Merhaba Zalim Dünya') etiket.pack() düğme = tk.Button(text='Tamam', command=pencere.destroy) düğme.pack() pencere.mainloop()
[ "osmanraifgunes@gmail.com" ]
osmanraifgunes@gmail.com
efb6d49912852567e840d7d060577207271bfb3d
3a30af04ebb4970896de7554a3384e5777556b6d
/B_Transformation and ICP/slam_04_c_estimate_transform_question.py
d0c28e76f07ef6fac76727b9ddb40ecb2d8f7100
[]
no_license
konanrobot/Filter-SLAM
be757e9b0ae0b2c4a2ee348d4d504130c939cbb8
52898bcc374baaf7a48df02ae51ed0000c673c4e
refs/heads/master
2021-06-17T11:16:45.779883
2017-05-25T15:23:30
2017-05-25T15:23:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,182
py
# For each cylinder in the scan, find its cartesian coordinates, # in the world coordinate system. # Find the closest pairs of cylinders from the scanner and cylinders # from the reference, and the optimal transformation which aligns them. # Then, output the scanned cylinders, using this transform. # 04_c_estimate_transform # XU Shang, 2015-08-18 from lego_robot import * from slam_b_library import filter_step from slam_04_a_project_landmarks import\ compute_scanner_cylinders, write_cylinders from math import sqrt # Given a list of cylinders (points) and reference_cylinders: # For every cylinder, find the closest reference_cylinder and add # the index pair (i, j), where i is the index of the cylinder, and # j is the index of the reference_cylinder, to the result list. # This is the function developed in slam_04_b_find_cylinder_pairs. def find_cylinder_pairs(cylinders, reference_cylinders, max_radius): cylinder_pairs = [] # --->>> Insert here your code from the last question, # slam_04_b_find_cylinder_pairs. return cylinder_pairs # Given a point list, return the center of mass. def compute_center(point_list): # Safeguard against empty list. if not point_list: return (0.0, 0.0) # If not empty, sum up and divide. sx = sum([p[0] for p in point_list]) sy = sum([p[1] for p in point_list]) return (float(sx) / len(point_list), float(sy) / len(point_list)) # Given a left_list of points and a right_list of points, compute # the parameters of a similarity transform: scale, rotation, translation. # If fix_scale is True, use the fixed scale of 1.0. # The returned value is a tuple of: # (scale, cos(angle), sin(angle), x_translation, y_translation) # i.e., the rotation angle is not given in radians, but rather in terms # of the cosine and sine. def estimate_transform(left_list, right_list, fix_scale = False): # Compute left and right center. lc = compute_center(left_list) rc = compute_center(right_list) # --->>> Insert here your code to compute lambda, c, s and tx, ty. return la, c, s, tx, ty # Given a similarity transformation: # trafo = (scale, cos(angle), sin(angle), x_translation, y_translation) # and a point p = (x, y), return the transformed point. def apply_transform(trafo, p): la, c, s, tx, ty = trafo lac = la * c las = la * s x = lac * p[0] - las * p[1] + tx y = las * p[0] + lac * p[1] + ty return (x, y) if __name__ == '__main__': # The constants we used for the filter_step. scanner_displacement = 30.0 ticks_to_mm = 0.349 robot_width = 150.0 # The constants we used for the cylinder detection in our scan. minimum_valid_distance = 20.0 depth_jump = 100.0 cylinder_offset = 90.0 # The maximum distance allowed for cylinder assignment. max_cylinder_distance = 300.0 # The start pose we obtained miraculously. pose = (1850.0, 1897.0, 3.717551306747922) # Read the logfile which contains all scans. logfile = LegoLogfile() logfile.read("robot4_motors.txt") logfile.read("robot4_scan.txt") # Also read the reference cylinders (this is our map). logfile.read("robot_arena_landmarks.txt") reference_cylinders = [l[1:3] for l in logfile.landmarks] out_file = file("estimate_transform.txt", "w") for i in xrange(len(logfile.scan_data)): # Compute the new pose. pose = filter_step(pose, logfile.motor_ticks[i], ticks_to_mm, robot_width, scanner_displacement) # Extract cylinders, also convert them to world coordinates. cartesian_cylinders = compute_scanner_cylinders( logfile.scan_data[i], depth_jump, minimum_valid_distance, cylinder_offset) world_cylinders = [LegoLogfile.scanner_to_world(pose, c) for c in cartesian_cylinders] # For every cylinder, find the closest reference cylinder. cylinder_pairs = find_cylinder_pairs( world_cylinders, reference_cylinders, max_cylinder_distance) # Estimate a transformation using the cylinder pairs. trafo = estimate_transform( [world_cylinders[pair[0]] for pair in cylinder_pairs], [reference_cylinders[pair[1]] for pair in cylinder_pairs], fix_scale = True) # Transform the cylinders using the estimated transform. transformed_world_cylinders = [] if trafo: transformed_world_cylinders =\ [apply_transform(trafo, c) for c in [world_cylinders[pair[0]] for pair in cylinder_pairs]] # Write to file. # The pose. print >> out_file, "F %f %f %f" % pose # The detected cylinders in the scanner's coordinate system. write_cylinders(out_file, "D C", cartesian_cylinders) # The detected cylinders, transformed using the estimated trafo. write_cylinders(out_file, "W C", transformed_world_cylinders) out_file.close()
[ "xushangnjlh@gmail.com" ]
xushangnjlh@gmail.com
a33eefbf9b26a91be2b862f3f88994ead11d060e
27404287781cdbc9f66c75cb3f3bdc20e602740c
/util.py
ab9481c0d986c78301245646a4b725eb334e420f
[]
no_license
z-van-baars/Citigen
20f713fe45f8a012a311c35c17b51f32ae7d948a
0ce0eed94c7313741b65c1739befd017a322308a
refs/heads/master
2022-04-23T18:08:53.620323
2020-04-29T05:16:08
2020-04-29T05:16:08
257,134,459
0
0
null
null
null
null
UTF-8
Python
false
false
4,153
py
import random import math import string import pygame CHARACTERS = (string.ascii_letters + string.digits + '-._~') def generate_unique_key(length=8): """Returns a unique unicode key of length l, default=8""" return ''.join(random.sample(CHARACTERS, length)) def generate_coordinate_pair(minmax): x = random.randrange(minmax[0], minmax[1]) y = random.randrange(minmax[0], minmax[1]) return (x, y) def get_midpoint(a, b): x1 = (a[0] - b[0]) / 2. y1 = (a[1] - b[1]) / 2. return x1, y1 def coordinates_to_region_index(voronoi_object, coordinates): vor = voronoi_object xy1 = tuple(coordinates) region_index = 0 for xyi in vor.point_region: xy2 = tuple(vor.points[region_index]) if xy2[0] == xy1[0] and xy2[1] == xy1[1]: return xyi region_index += 1 print("no match found") def coordinates_to_point_index(voronoi_object, coordinates): vor = voronoi_object xy1 = tuple(coordinates) for point_index, point in enumerate(vor.points): xy2 = tuple(point) if xy2[0] == xy1[0] and xy2[1] == xy1[1]: return point_index def coord_list_match(list1, point_1): for point_2 in list1: if point_1[0] == point_2[0] and point_1[1] == point_2[1]: return True return False def get_closest_edge(map_size, point): distances = [(get_length(point, (point[0], -map_size * 0.5)), 0), (get_length(point, (point[0], map_size * 0.5)), 1), (get_length(point, (-map_size * 0.5, point[1])), 2), (get_length(point, (map_size * 0.5, point[1])), 3)] return sorted(distances, key=lambda d: d[0])[0][1] def get_neighbors(dela, vertex): # unpack vertex_neighbor_vertices just so it's easier to type a = dela.vertex_neighbor_vertices[0] b = dela.vertex_neighbor_vertices[1] # The indices of neighboring vertices of 'vertex' are indptr[indices['vertex']:indices['vertex'+1]]. return b[a[vertex]: a[vertex + 1]] def get_length(pt_A, pt_B): """Pythagorean Distance Formula, returns a float""" a2 = (pt_A[0] - pt_B[0]) ** 2 b2 = (pt_A[1] - pt_B[1]) ** 2 c2 = math.sqrt(a2 + b2) # reut return round(c2, 3) def lloyd_relaxation(vor): """A Pseudo-Lloyd relaxation function that just averages the points of resulting voronoi polygons together and returns an approximated centroid. This will nicely spread out bunched up dots, but it does have a tendency over time to spread points out, with a disproportionate effect on points toward the edges of the graph. A potential idea for future improvement is to have some kind of diff function that would compensate for points drifting off the edge. Right now there's a cull function that takes place immediately after this function is called that trims off any points that crept out of the scope of the graph. This works and is fast but it does ultimately result in a reduction of the number of dots overall.""" relaxed_points = [] for r_index, region in enumerate(vor.regions): corners = [] for vertex_index in region: if vertex_index is not -1: corners.append(vor.vertices[vertex_index]) # don't change any region centroids with vertices outside the voronoi if -1 in region: relaxed_points.append(vor.points[r_index - 1]) continue # skip the dummy empty region if len(region) < 3: continue centroid_lite = (int(sum(j[0] for j in corners) / len(corners)), int(sum(k[1] for k in corners) / len(corners))) relaxed_points.append(centroid_lite) # there is a bug here where occasionally one point is dropped? # only ever one, I'm confused # # if I uncomment this next line the assertion fails about 1:6 times # assert len(relaxed_points) == len(vor.points) return relaxed_points def quit_check(): for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.display.quit() pygame.quit()
[ "zvanbaars@gmail.com" ]
zvanbaars@gmail.com
85722f6d4dadf839b0b2b64b210aa5a325367cd5
5e0755091efd2d4ed61bead8aa38b45bab5a8b07
/python/anyascii/_data/_1b0.py
4d80487311c754b87a50572f39d147a8be20a53e
[ "ISC" ]
permissive
casept/anyascii
c27261d87257c17c47fe0e9fc77438437de94c1c
d4f426b91751254b68eaa84c6cd23099edd668e6
refs/heads/master
2022-12-05T07:13:53.075144
2020-08-07T07:55:50
2020-08-07T07:55:50
285,904,577
0
0
ISC
2020-08-07T19:20:00
2020-08-07T19:19:59
null
UTF-8
Python
false
false
748
py
b='e e a a a a i i i i u u u u u e e e e e o o o ka ka ka ka ka ka ka ka ka ka ka ka ki ki ki ki ki ki ki ki ku ku ku ku ku ku ku ke ke ke ke ke ke ko ko ko ko sa sa sa sa sa sa sa sa si si si si si si su su su su su su su su se se se se se so so so so so so so ta ta ta ta ti ti ti ti ti ti ti tu tu tu tu tu te te te te te te te te te to to to to to to to na na na na na na na na na ni ni ni ni ni ni ni ni nu nu nu ne ne ne ne ne ne ne no no no no no ha ha ha ha ha ha ha ha ha ha ha hi hi hi hi hi hi hi hu hu hu he he he he he he he ho ho ho ho ho ho ho ho ma ma ma ma ma ma ma mi mi mi mi mi mi mi mu mu mu mu me me me mo mo mo mo mo mo ya ya ya ya ya ya yu yu yu yu yo yo yo yo yo yo ra ra ra ra ri ri ri ri ri ri ri ru ru ru ru ru ru re re'
[ "hunter@hunterwb.com" ]
hunter@hunterwb.com
9ae7e8b3abe41c13083a6010f9fb09895c3d755e
b1cf797d4d26553a6121d36bb560097260c462f3
/math.py
66fbbae7a20df53adfbce836f68c3f7215bfb13c
[]
no_license
gahlm/DarkOverLordsCreepyDungeon
1bc8812094151354ed26f66234c50a765f7de911
9ab6b79ea27a6a7ac903f348ca7c2eedec337c34
refs/heads/master
2022-09-10T09:04:02.730706
2020-06-04T15:49:28
2020-06-04T15:49:28
269,231,222
0
1
null
2020-06-04T15:49:29
2020-06-04T01:22:10
Python
UTF-8
Python
false
false
328
py
import random class Dice: def __init__(self, name, value): self.name = name self.value = value def get_dice(self): return random.randrange(1, int(self.value + 1)) d2 = Dice("d2", 2) d4 = Dice("d4", 4) d6 = Dice("d6", 6) d8 = Dice("d8", 8) d10 = Dice("d10", 10) dice = [d2, d4, d6, d8, d10]
[ "noreply@github.com" ]
gahlm.noreply@github.com
c51225515680be1d025e75852fbe272c51510692
b40d57de3d06884822f9b4e7dee0c07bdb00ab29
/ENV/bin/python-config
518fa5a69982e217531e5a743f74856432984435
[]
no_license
chrislupdx/URLshort
44dc562cd3abd0eac3614f9472e6e87e0cd07462
b74a0abcfc9091fd5469d6973df38040c39300c7
refs/heads/master
2020-03-26T06:45:52.837644
2018-10-29T20:47:07
2018-10-29T20:47:07
144,620,878
0
0
null
null
null
null
UTF-8
Python
false
false
2,344
#!/home/egh/Homework/URL/ENV/bin/python import sys import getopt import sysconfig valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 'ldflags', 'help'] if sys.version_info >= (3, 2): valid_opts.insert(-1, 'extension-suffix') valid_opts.append('abiflags') if sys.version_info >= (3, 3): valid_opts.append('configdir') def exit_with_usage(code=1): sys.stderr.write("Usage: {0} [{1}]\n".format( sys.argv[0], '|'.join('--'+opt for opt in valid_opts))) sys.exit(code) try: opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) except getopt.error: exit_with_usage() if not opts: exit_with_usage() pyver = sysconfig.get_config_var('VERSION') getvar = sysconfig.get_config_var opt_flags = [flag for (flag, val) in opts] if '--help' in opt_flags: exit_with_usage(code=0) for opt in opt_flags: if opt == '--prefix': print(sysconfig.get_config_var('prefix')) elif opt == '--exec-prefix': print(sysconfig.get_config_var('exec_prefix')) elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_path('include'), '-I' + sysconfig.get_path('platinclude')] if opt == '--cflags': flags.extend(getvar('CFLAGS').split()) print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): abiflags = getattr(sys, 'abiflags', '') libs = ['-lpython' + pyver + abiflags] libs += getvar('LIBS').split() libs += getvar('SYSLIBS').split() # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) if not getvar('PYTHONFRAMEWORK'): libs.extend(getvar('LINKFORSHARED').split()) print(' '.join(libs)) elif opt == '--extension-suffix': ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') if ext_suffix is None: ext_suffix = sysconfig.get_config_var('SO') print(ext_suffix) elif opt == '--abiflags': if not getattr(sys, 'abiflags', None): exit_with_usage() print(sys.abiflags) elif opt == '--configdir': print(sysconfig.get_config_var('LIBPL'))
[ "christopherlu.pdx@gmail.com" ]
christopherlu.pdx@gmail.com
a35cbfcc66192e32df195659da657709620feccb
f4271f87915f2ce7f0906801485b41a67790ce59
/cart/urls.py
c05d0b8d3b29a15683bce11264f1b6d0383afc9e
[]
no_license
ikeyurp/Courseily
388560a85d6f4dcee767c01246bb8974ddf65949
cd0c0be78c0a0061615951fbbac5e2c594741765
refs/heads/main
2023-03-19T05:29:56.486841
2021-03-14T18:30:32
2021-03-14T18:30:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
338
py
from django.urls import path from . import views app_name = 'cart' urlpatterns = [ path('', views.cart_detail, name='cart_detail'), path('add/<slug:slug>/', views.cart_add, name='cart_add'), path('remove/<slug:slug>', views.cart_remove, name='cart_remove'), path('checkout', views.cart_checkout, name='cart_checkout'), ]
[ "keyurbhut12345@gmail.com" ]
keyurbhut12345@gmail.com
5bceb0d3f3d2d2bd9a515aaf742430e092604d10
4d496a62949c25a4c5eabfc617d25d8f6bfbc713
/Aula 7 Funções e Métodos.py
32d749fdf169ab3480aa296823536d91fbf25579
[]
no_license
Jhonnylibra/Aprendendo-Python
57bede8a48e93f876353f36a5fe55533b72a0440
fa03dbd688d9e2928f40275773c7a9e854ba1f3f
refs/heads/main
2023-05-12T17:40:50.406002
2021-05-31T00:11:52
2021-05-31T00:11:52
367,945,375
1
0
null
null
null
null
UTF-8
Python
false
false
589
py
class Calculadora: def __init__(self, num1, num2): self.valor_a = num1 self.valor_b = num2 # Funções retornam valores def soma(self): return self.valor_a + self.valor_b def subtracao(self): return self.valor_a - self.valor_b def multip(self): return self.valor_a * self.valor_b def divisao(self): return self.valor_a / self.valor_b calculo = Calculadora (10,2) print(calculo.valor_a) print(calculo.soma()) print(calculo.subtracao()) print(calculo.multip()) print(calculo.divisao())
[ "noreply@github.com" ]
Jhonnylibra.noreply@github.com
16fe7899fdb89976f298c7e6c833803990bebb7f
e13584adb4d99aa355de6b4674d01e819a874b59
/env/bin/python-config
c7510464bb7ec892148c05d85b1b771877a85b08
[]
no_license
monetree/algoscale
d6a4b66c50faf6529a74301513ca42a9492b07d0
86b7fb4e8ea22fb84d64e2703905ab95bde827f3
refs/heads/master
2020-03-30T10:35:26.528734
2018-10-01T17:17:24
2018-10-01T17:17:24
151,126,850
0
0
null
null
null
null
UTF-8
Python
false
false
2,355
#!/home/soubhagya/Desktop/algoscale/env/bin/python import sys import getopt import sysconfig valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 'ldflags', 'help'] if sys.version_info >= (3, 2): valid_opts.insert(-1, 'extension-suffix') valid_opts.append('abiflags') if sys.version_info >= (3, 3): valid_opts.append('configdir') def exit_with_usage(code=1): sys.stderr.write("Usage: {0} [{1}]\n".format( sys.argv[0], '|'.join('--'+opt for opt in valid_opts))) sys.exit(code) try: opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) except getopt.error: exit_with_usage() if not opts: exit_with_usage() pyver = sysconfig.get_config_var('VERSION') getvar = sysconfig.get_config_var opt_flags = [flag for (flag, val) in opts] if '--help' in opt_flags: exit_with_usage(code=0) for opt in opt_flags: if opt == '--prefix': print(sysconfig.get_config_var('prefix')) elif opt == '--exec-prefix': print(sysconfig.get_config_var('exec_prefix')) elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_path('include'), '-I' + sysconfig.get_path('platinclude')] if opt == '--cflags': flags.extend(getvar('CFLAGS').split()) print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): abiflags = getattr(sys, 'abiflags', '') libs = ['-lpython' + pyver + abiflags] libs += getvar('LIBS').split() libs += getvar('SYSLIBS').split() # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) if not getvar('PYTHONFRAMEWORK'): libs.extend(getvar('LINKFORSHARED').split()) print(' '.join(libs)) elif opt == '--extension-suffix': ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') if ext_suffix is None: ext_suffix = sysconfig.get_config_var('SO') print(ext_suffix) elif opt == '--abiflags': if not getattr(sys, 'abiflags', None): exit_with_usage() print(sys.abiflags) elif opt == '--configdir': print(sysconfig.get_config_var('LIBPL'))
[ "soubhagyakumar666@gmail.com" ]
soubhagyakumar666@gmail.com
a7a100d9fb9ff8d513977a88dd73613b8130d2ad
feecc591c08bf23f1ff78826549d326dd53d1f20
/run_sampling_fixed_parameters.py
3a34f23e01eea7a865c1bf7b58d87cf3d919d355
[]
no_license
LoLab-MSM/CORM
cd732615021ef19c9f8ad89447acdcb8e7f14b83
71630627eb1e1afa80bd449acb8fde026ca2d6c0
refs/heads/master
2022-11-24T03:24:12.858546
2017-02-28T20:17:49
2017-02-28T20:17:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,620
py
# -*- coding: utf-8 -*- """ Created on Wed Mar 23 16:58:34 2016 @author: Erin """ # -*- coding: utf-8 -*- """ Created on Tue Dec 9 15:26:46 2014 @author: Erin """ from core import run_dream from pysb.integrate import Solver import numpy as np from parameters import NormalParam from scipy.stats import norm import pysb from corm import model as cox2_model #pysb.integrate.weave_inline = None #Initialize PySB solver object for simulations tspan = np.linspace(0,10, num=100) solver = Solver(cox2_model, tspan) #Add import of experimental data here #location = '/Users/Erin/git/COX2/exp_data/' location= '/home/shockle/COX2_kinetics/exp_data' exp_data_PG = np.loadtxt(location+'exp_data_pg.txt') exp_data_PGG = np.loadtxt(location+'exp_data_pgg.txt') exp_data_sd_PG = np.loadtxt(location+'exp_data_sd_pg.txt') exp_data_sd_PGG = np.loadtxt(location+'exp_data_sd_pgg.txt') #Experimental starting values of AA and 2-AG (all in microM) exp_cond_AA = [0, .5, 1, 2, 4, 8, 16] exp_cond_AG = [0, .5, 1, 2, 4, 8, 16] #Experimentally measured parameter values KD_AA_cat1 = np.log10(cox2_model.parameters['kr_AA_cat1'].value/cox2_model.parameters['kf_AA_cat1'].value) kcat_AA1 = np.log10(cox2_model.parameters['kcat_AA1'].value) KD_AG_cat1 = np.log10(cox2_model.parameters['kr_AG_cat1'].value/cox2_model.parameters['kf_AG_cat1'].value) kcat_AG1 = np.log10(cox2_model.parameters['kcat_AG1'].value) KD_AG_allo3 = np.log10(cox2_model.parameters['kr_AG_allo3'].value/cox2_model.parameters['kf_AG_allo3'].value) kf_idxs = [i for i, param in enumerate(cox2_model.parameters) if 'kf' in param.name] #generic kf in units of inverse microM*s (matches model units) generic_kf = np.log10(1.5e4) #Frozen probability distributions for likelihoods like_PGs = norm(loc=exp_data_PG, scale=exp_data_sd_PG) like_PGGs = norm(loc=exp_data_PGG, scale=exp_data_sd_PGG) like_thermobox = norm(loc=1, scale=1e-2) pysb_sampled_parameter_names = ['kr_AA_cat2', 'kcat_AA2', 'kr_AA_cat3', 'kcat_AA3', 'kr_AG_cat2', 'kr_AG_cat3', 'kcat_AG3', 'kr_AA_allo1', 'kr_AA_allo2', 'kr_AA_allo3', 'kr_AG_allo1', 'kr_AG_allo2'] kfs_to_change = ['kf_AA_cat2', 'kf_AA_cat3', 'kf_AG_cat2', 'kf_AG_cat3', 'kf_AA_allo1', 'kf_AA_allo2', 'kf_AA_allo3', 'kf_AG_allo1', 'kf_AG_allo2'] kf_idxs = [i for i, param in enumerate(cox2_model.parameters) if param.name in kfs_to_change] print 'kf idxs: ',kf_idxs #Likelihood function to generate simulated data that corresponds to experimental time points def likelihood(parameter_vector): #print 'model parameters before subbing: ',cox2_model.parameters param_dict = {pname: pvalue for pname, pvalue in zip(pysb_sampled_parameter_names, parameter_vector)} #print 'param dict: ',param_dict for pname, pvalue in param_dict.items(): #Sub in parameter values at current location in parameter space if 'kr' in pname: cox2_model.parameters[pname].value = 10**(pvalue + generic_kf) elif 'kcat' in pname: cox2_model.parameters[pname].value = 10**pvalue #print 'model parameters after subbing: ',cox2_model.parameters PG_array = np.zeros((7,7), dtype='float64') PGG_array = np.zeros((7,7), dtype='float64') arr_row = 0 arr_col = 0 #Simulate and fill in arrays for AA_init in exp_cond_AA: for AG_init in exp_cond_AA: cox2_model.parameters['AA_0'].value = AA_init cox2_model.parameters['AG_0'].value = AG_init solver.run() PG_array[arr_row, arr_col] = solver.yobs['obsPG'][-1] PGG_array[arr_row, arr_col] = solver.yobs['obsPGG'][-1] if arr_col < 6: arr_col += 1 else: arr_col = 0 arr_row += 1 #mBid_pdf_pt = (sim_mBid - exp_data['norm_ICRP'])/mBid_sd # np.log((np.exp(-(mBid_pdf_pt**2)/2)/(np.sqrt(2*np.pi)*mBid_sd))) #pg_pdf_pt = (PG_array - exp_data_PG)/exp_data_sd_PG #logp_PG_2 = np.sum(np.log((np.exp(-(pg_pdf_pt**2)/2)/np.sqrt(2*np.pi)*exp_data_sd_PG))) #pgg_pdf_pt = (PGG_array - exp_data_PGG)/exp_data_sd_PGG #logp_PGG_2 = np.sum(np.log((np.exp(-(pgg_pdf_pt**2)/2)/np.sqrt(2*np.pi)*exp_data_sd_PGG))) logp_PG = np.sum(like_PGs.logpdf(PG_array)) logp_PGG = np.sum(like_PGGs.logpdf(PGG_array)) box1 = (1/(10**KD_AA_cat1))*(1/(10**param_dict['kr_AA_allo2']))*(10**param_dict['kr_AA_cat3'])*(10**param_dict['kr_AA_allo1']) box2 = (1/(10**param_dict['kr_AA_allo1']))*(1/(10**param_dict['kr_AG_cat3']))*(10**param_dict['kr_AA_allo3'])*(10**KD_AG_cat1) box3 = (1/(10**param_dict['kr_AG_allo1']))*(1/(10**param_dict['kr_AA_cat2']))*(10**param_dict['kr_AG_allo2'])*(10**KD_AA_cat1) box4 = (1/(10**KD_AG_cat1))*(1/(10**KD_AG_allo3))*(10**param_dict['kr_AG_cat2'])*(10**param_dict['kr_AG_allo1']) #box_pdf_pt = (box1 - 1)/1e-2 #logp_box1_2 = np.sum(np.log((np.exp(-(box_pdf_pt**2)/2)/np.sqrt(2*np.pi)*1e-2))) logp_box1 = like_thermobox.logpdf(box1) logp_box2 = like_thermobox.logpdf(box2) logp_box3 = like_thermobox.logpdf(box3) logp_box4 = like_thermobox.logpdf(box4) #print 'logps: ',logp_PG,logp_PGG,logp_box1, logp_box2, logp_box3, logp_box4 #print 'logps 2: ',logp_PG_2, logp_PGG_2, logp_box1_2 total_logp = logp_PG + logp_PGG + logp_box1 + logp_box2 + logp_box3 + logp_box4 if np.isnan(total_logp): total_logp = -np.inf return total_logp # Add PySB rate parameters as unobserved random variables kd_AA_cat2 = NormalParam('KD_AA_cat2', value = 1, mu=np.log10(cox2_model.parameters['kr_AA_cat2'].value/cox2_model.parameters['kf_AA_cat2'].value), sd=1.5) kcat_AA2 = NormalParam('kcat_AA2', value = 1, mu=np.log10(cox2_model.parameters['kcat_AA2'].value), sd=.66) kd_AA_cat3 = NormalParam('KD_AA_cat3', value = 1, mu=np.log10(cox2_model.parameters['kr_AA_cat3'].value/cox2_model.parameters['kf_AA_cat3'].value), sd=1.5) kcat_AA3 = NormalParam('kcat_AA3', value = 1, mu=np.log10(cox2_model.parameters['kcat_AA1'].value), sd=.66) kd_AG_cat2 = NormalParam('KD_AG_cat2', value = 1, mu=np.log10(cox2_model.parameters['kr_AG_cat2'].value/cox2_model.parameters['kf_AG_cat2'].value), sd=1.5) kd_AG_cat3 = NormalParam('KD_AG_cat3', value = 1, mu=np.log10(cox2_model.parameters['kr_AG_cat3'].value/cox2_model.parameters['kf_AG_cat3'].value), sd=1.5) kcat_AG3 = NormalParam('kcat_AG3', value = 1, mu=np.log10(cox2_model.parameters['kcat_AG3'].value), sd=.66) kd_AA_allo1 = NormalParam('KD_AA_allo1', value = 1, mu=np.log10(cox2_model.parameters['kr_AA_allo1'].value/cox2_model.parameters['kf_AA_allo1'].value), sd=1) kd_AA_allo2 = NormalParam('KD_AA_allo2', value = 1, mu=np.log10(cox2_model.parameters['kr_AA_allo2'].value/cox2_model.parameters['kf_AA_allo2'].value), sd=1) kd_AA_allo3 = NormalParam('KD_AA_allo3', value = 1, mu=np.log10(cox2_model.parameters['kr_AA_allo3'].value/cox2_model.parameters['kf_AA_allo3'].value), sd=1) kd_AG_allo1 = NormalParam('KD_AG_allo1', value = 1, mu=np.log10(cox2_model.parameters['kr_AG_allo1'].value/cox2_model.parameters['kf_AG_allo1'].value), sd=1) kd_AG_allo2 = NormalParam('KD_AG_allo2', value = 1, mu=np.log10(cox2_model.parameters['kr_AG_allo2'].value/cox2_model.parameters['kf_AG_allo2'].value), sd=1) sampled_parameter_names = [kd_AA_cat2, kcat_AA2, kd_AA_cat3, kcat_AA3, kd_AG_cat2, kd_AG_cat3, kcat_AG3, kd_AA_allo1, kd_AA_allo2, kd_AA_allo3, kd_AG_allo1, kd_AG_allo2] for param in sampled_parameter_names: print 'param.mu: ',param.mu,' and standard deviation: ',param.sd nchains = 5 #starts = np.zeros((5, 12)) #for chain in range(len(old_results[0:5])): # for param_name in pysb_sampled_parameter_names: # new_dim = new_ordering_dict[param_name] # old_dim = old_ordering_dict[param_name] # starts[chain][new_dim] = old_results[chain][old_dim] #print 'starts: ',starts #start_val = [param.mu for param in sampled_parameter_names] #starts = start_val + (np.random.random((nchains, len(start_val)))*.01) #starts = [np.array([param.mu for param in sampled_parameter_names]) for i in range(5)] for idx in kf_idxs: cox2_model.parameters[idx].value = 10**generic_kf sampled_params, log_ps = run_dream(sampled_parameter_names, likelihood, niterations=20000, nchains=nchains, multitry=False, gamma_levels=4, adapt_gamma=True, history_thin=1, model_name='corm_dreamzs_5chain_redo', verbose=True) for chain in range(len(sampled_params)): np.save('corm_dreamzs_5chain_redo_sampled_params_chain_'+str(chain), sampled_params[chain]) np.save('corm_dreamzs_5chain_redo_logps_chain_'+str(chain), log_ps[chain])
[ "erin.shockley@vanderbilt.edu" ]
erin.shockley@vanderbilt.edu
0f6141d3b2eed8a6a8945815a306d2ecf31c065d
05723c953a5ce5392c9db0210e4cfe13a1621e1c
/src/server.py
eca7891b271a408fcb0db35dd74c45c107ac4b50
[ "MIT" ]
permissive
Shicheng-Guo/recountmethylation_server
269bac8c81e7fbeb67a828ccd62294bded6f2b6a
e7cfaaca431f1b063c3ed2715f62de0a06845448
refs/heads/master
2023-06-16T02:57:03.050080
2021-07-08T17:49:47
2021-07-08T17:49:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
9,014
py
#!/usr/bin/env python3 """ server.py Authors: Sean Maden, Abhinav Nellore Description: Server script to manage an instance of the recount-methylation database. Overview: A recount-methylation instance consists of files (namely edirect query results, experiment metadata in soft format, and methylation array intensity data or 'idat' files) obtained from edirect queries and ftp-called downloads from the Gene Expression Omnibus (GEO). RMDB is a recount-methylation Mongo database that aggregates file metadata as documents, including experiement (GSE) and sample (GSM) IDs, ftp addresses and file paths to downloaded files, and a datetime-formatted date corresponding to last file update. Files are versioned using NTP timestamps in filenames. For best results, we recommend users attempt an initial setup of their recount-methylation instance using default generated directory trees and filenames, and do not directly change locations or names of files initially downloaded. Server Processes: The server.py script manages process queues, error handling, and coordination of recount-methylation. It currently uses Celery distributed task queue to queue jobs synchronously. Jobs are brokered using RabbitMQ, and queue details are backed up locally in a SQLite db. It is recommend you consult the SQLite backend database for details about interruptions to server operations. Dependencies and Setup: 1. Recount-methylation primarily uses Python 3 for download handling and file management. R is used for SOFT-to-JSON conversion, and for preprocessing arrays. MetaSRA-pipeline, which runs using Python 2, is used for mapping experiment metadata to ENCODE ontology terms, and we recommend installing a fork of the original repo (available here: <https://github.com/metamaden/MetaSRA-pipeline>). 2. Clone the recount-methylation-server repo from GitHub (available here: <>). 3. To run recount-methylation server.py, follow all provided setup and readme instructions. Also ensure the following resources are installed and running: * Celery (http://www.celeryproject.org/) * RabbitMQ (https://www.rabbitmq.com/) * MongoDB (https://www.mongodb.com/) * SQLite (https://www.sqlite.org/) """ import subprocess, glob, sys, os, re sys.path.insert(0, os.path.join("recountmethylation_server","src")) import edirect_query, settings; settings.init() from edirect_query import gsm_query, gse_query, gsequery_filter from utilities import gettime_ntp, getlatest_filepath, querydict from utilities import get_queryfilt_dict def firsttime_run(filedir='recount-methylation-files', run_timestamp=gettime_ntp()): """ firsttime_run On first setup, run new equeries and query filter. Arguments: * filedir (str): Dir name for db files. * run_timestamp (str) : NTP timestamp or function to retrieve it. Returns: * gseidlist (list): List of valid GSE IDs. """ print("Beginning first time server run...") equery_dest = settings.equerypath; temppath = settings.temppath gse_query(); gsm_query() gseqfile = getlatest_filepath(equery_dest,'gse_edirectquery') gsmqfile = getlatest_filepath(equery_dest,'gsm_edirectquery') gsequery_filter() gsefiltpath = getlatest_filepath(equery_dest,'gsequery_filt') if gsefiltpath: gsefiltd = querydict(querypath=gsefiltpath,splitdelim=' ') gseidlist = list(gsefiltd.keys()) print("GSE id list of len "+str(len(gseidlist))+" found. Returning...") return gseidlist else: print("Error retrieving gse query filtered file. Returning...") return None return None def scheduled_run(eqfilt_path=False, run_timestamp=gettime_ntp()): """ scheduled_run Tasks performed on regular schedule, after first setup. For the job queue, a list of GSE IDs is returned. The id list is filtered on existing GSE soft files to prioritize unrepresented experiments for download. Arguments: * eqfilt_path (str) : Filepath to edirect query filter file. * filedir (str) : Root name of files directory. * run_timestamp (str) : NTP timestamp or function to retrieve it. Returns: * gse_list (list) : list of valid GSE IDs, or None if error occurs """ try: gsefiltd = get_queryfilt_dict() except: print("No gse query filt file found, checking for GSE and GSM " +"queries...") gsequery_latest = getlatest_filepath(filepath=eqpath, filestr='gse_edirectquery') if not gsequery_latest: gse_query() gsmquery_latest = getlatest_filepath(eqpath,'gsm_edirectquery') if not gsmquery_latest: gsm_query() print("Running filter on GSE query...") gsequery_filter(); gsefiltd = get_queryfilt_dict() # get list of GSE IDs from existing SOFT files gsesoftfiles = os.listdir(settings.gsesoftpath) print("GSE SOFT files: " + str(gsesoftfiles));rxgse=re.compile('GSE[0-9]*') gseid_softexists = [str(rxgse.findall(softfn)[0]) for softfn in gsesoftfiles if rxgse.findall(softfn)] if gsefiltd: gseid_listall = list(gsefiltd.keys()) print("GSE ID list of len "+str(len(gseid_listall)) + " found. Filtering..") if gseid_softexists and len(gseid_softexists)>0: gseid_filt = [gseid for gseid in gseid_listall if not gseid in gseid_softexists] else: gseid_filt = gseid_listall print("After filtering existing SOFT files, N = "+str(len(gseid_filt)) +" GSE IDs remain. Returning ID list...") # if all GSE IDs represented, return all GSE IDs for brand new run if len(gseid_filt)==len(gseid_listall): gseid_filt = gseid_listall return gseid_filt else: print("Error forming equery filt dictionary. Returning...") return None if __name__ == "__main__": """ Recount-methylation sever server.py main Code addresses various contingencies precluding generation of GSE ID list. Once list can be made, it is used to populate a new Celery queue. """ print("Starting server.py..."); import subprocess, glob, sys, os, re sys.path.insert(0, os.path.join("recountmethylation_server","src")) import edirect_query, settings, argparse; settings.init() from edirect_query import gsm_query, gse_query, gsequery_filter from utilities import gettime_ntp, getlatest_filepath, querydict from utilities import get_queryfilt_dict from gse_celerytask import gse_task; from random import shuffle gselist = [] # queue input, gse-based qstatlist = [] # job status object, also stored at sqlite db print("Getting timestamp...") run_timestamp = gettime_ntp() # pass this result to child functions # Parse the specified GSE ID. parser = argparse.ArgumentParser(description='Arguments for server.py') parser.add_argument("--gseid", type=str, required=False, default=None, help='Option to enter valid GSE ID for immediate download.') args = parser.parse_args() # For the job queue, either from provided argument or automation if args.gseid: print("Provided GSE ID detected. Processing...") gqd = get_queryfilt_dict() qstatlist.append(gse_task(gse_id = args.gseid, gsefiltdict=gqd, timestamp = run_timestamp)) else: print("No GSE ID(s) provided. Forming ID list for job queue...") files_dir = settings.filesdir if os.path.exists(files_dir): print("Directory : "+files_dir+" found.") if not os.path.exists(settings.gsesoftpath): print("Couldn't find path ",settings.gsesoftpath, ", making new dir..."); os.mkdir(settings.gsesoftpath) print("Running scheduled_run...") gselist = scheduled_run(run_timestamp=run_timestamp) else: print("Directory : "+files_dir+" not found. Creating filesdir and " +"running firsttime_run...") os.makedirs(files_dir, exist_ok=True) gselist = firsttime_run(run_timestamp=run_timestamp) if gselist: print("Shuffling GSE ID list...") shuffle(gselist) # randomize GSE ID order print("Beginning job queue for GSE ID list of "+str(len(gselist)) +" samples...") gqd = get_queryfilt_dict() # one eqfilt call for all jobs this run for gse in gselist: qstatlist.append(gse_task(gse_id=gse, gsefiltdict=gqd, timestamp=run_timestamp)) else: print("Error: valid gselist absent. Returning...")
[ "maden@ohsu.edu" ]
maden@ohsu.edu
0a92c2795618c067dffe8514cc858a8d46a72240
4f88c6737240c902d1093d1bc250137aa28c3669
/Hangman_game.py
a1f7e473ac23acf3cbdc22d67e72c729f6a03609
[]
no_license
jaydeep283/Hangman-Game
0a92bd540e85e428cbdb4710c2af7183097092f6
3e693bae05b02fb24011d9af713c57f99539fbf2
refs/heads/main
2023-07-05T17:23:34.040250
2021-08-28T15:19:36
2021-08-28T15:19:36
400,824,080
0
0
null
null
null
null
UTF-8
Python
false
false
4,997
py
# Hangman game which lets user to predict the letters from the random word chosen by program. #For choosing word randomly import random #Path for text file containing all possible words. WORDLIST_FILENAME = "words.txt" def loadWords(): """ Returns a list of valid words. Words are strings of lowercase letters. """ print("Loading word list from file...") # inFile: file inFile = open(WORDLIST_FILENAME, 'r') # line: string line = inFile.readline() # wordlist: list of strings wordlist = line.split() print(" ", len(wordlist), "words loaded.") return wordlist def chooseWord(wordlist): """ wordlist (list): list of words (strings) Returns a word from wordlist at random """ return random.choice(wordlist) # Loading the list of words into the variable wordlist # so that it can be accessed from anywhere in the program wordlist = loadWords() def isWordGuessed(secretWord, lettersGuessed): ''' secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: boolean, True if all the letters of secretWord are in lettersGuessed; False otherwise ''' sw_len = len(secretWord) lg_len = len(lettersGuessed) corr_guess = 0 for x in secretWord: if x in lettersGuessed: corr_guess = corr_guess + 1 if corr_guess == sw_len: return True else: return False def getGuessedWord(secretWord, lettersGuessed): ''' secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: string, comprised of letters and underscores that represents what letters in secretWord have been guessed so far. ''' g_str = '' for x in secretWord: if x in lettersGuessed: g_str = g_str + x else: g_str = g_str + '_ ' return g_str import string def getAvailableLetters(lettersGuessed): ''' lettersGuessed: list, what letters have been guessed so far returns: string, comprised of letters that represents what letters have not yet been guessed. ''' avl_lett = '' for x in string.ascii_lowercase: if x not in lettersGuessed: avl_lett = avl_lett + x return avl_lett def hangman(secretWord): ''' secretWord: string, the secret word to guess. Start of an interactive game of Hangman. * At the start of the game, it shows how many letters are there in secret word. * Asks the user to supply one guess (i.e. letter) per round. * The user receives feedback immediately after each guess about whether their guess appears in the computers word. * After each round, it displays to the user the partially guessed word so far, as well as letters that the user has not yet guessed. ''' print("Welcome to the game Hangman!") len_sec_word = len(secretWord) print("I am thinking of a word that is", len_sec_word, "letters long.") print("________________________") tot_guesses = 8 #Tracks the life i.e how many more times user can guess incorrect letter mistakes_Made = 0 lettersGuessed = [] #Stores the letters guessed so far by the user. avl_letters = getAvailableLetters(lettersGuessed) while tot_guesses > 0: print("You have", tot_guesses, "guesses left.") print("Available letters: ", getAvailableLetters(lettersGuessed)) guess = input("Please guess a letter: ") guess_lowercase = guess.lower() if guess_lowercase in secretWord and guess_lowercase not in lettersGuessed: lettersGuessed.append(guess_lowercase) print("Good guess: ", getGuessedWord(secretWord, lettersGuessed)) elif guess_lowercase in secretWord and guess_lowercase in lettersGuessed: print("Oops! You've already guessed that letter: ", getGuessedWord(secretWord, lettersGuessed)) else: if guess_lowercase in lettersGuessed: print("Oops! You've already guessed that letter: ", getGuessedWord(secretWord, lettersGuessed)) else: print("Oops! That letter is not in my word: ", getGuessedWord(secretWord, lettersGuessed)) lettersGuessed.append(guess_lowercase) tot_guesses = tot_guesses - 1 print("________________________") if isWordGuessed(secretWord, lettersGuessed): print("Congratulations, you won!") break if not isWordGuessed(secretWord, lettersGuessed): print("Sorry, you ran out of guesses. The word was " + secretWord + ".") # Start of the main program. # Chooses random word and passes it to hangman function to start the game. secretWord = chooseWord(wordlist) hangman(secretWord)
[ "noreply@github.com" ]
jaydeep283.noreply@github.com
974a2d4a88ed7a61a78b987b186da95ea207fda6
64ada708c3ee39c624a223fa4881ce3689041606
/Chapter3/list0303_2.py
5aaa75fbb416c44e7ca982dafdd8633312280cfa
[]
no_license
kimcaptin/PythonGame_1
1173cf3ac356d29b1cb254b1607bd4528e0a28cc
af32318bf1e6ea73aa00fc4c72d07e1a5d7c5300
refs/heads/main
2023-01-04T05:46:02.782910
2020-10-28T06:53:30
2020-10-28T06:53:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
119
py
gold = 100 if gold == 0: print("소지금이 없습니다") else: print("구입을 계속하시겠습니까?")
[ "jeipubmanager@gmail.com" ]
jeipubmanager@gmail.com
b22322fe3489c5384a325c3f92dd5aed24dc2fdc
1b88937115f698eaa40b3bf1f106bb5377ead4d5
/django_base/playlist/models.py
4f5ea70c37369e3a4cee3651a02f91c626d30e82
[ "MIT" ]
permissive
gasbarroni8/best-channels
259903ac6a280790e99fe5331570edd672027f59
f82a9b51be6292945e3d4ef2cd2702ac4fdbe0cf
refs/heads/master
2020-11-30T05:31:32.184496
2019-09-10T01:01:20
2019-09-10T01:01:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
861
py
from django.db import models from inner.models import Inner class Playlist(models.Model): HOT = 'hot' NEW = 'new' PLAYLIST_TYPE = ( (HOT, 'hot'), (NEW, 'new'), ) inner = models.ForeignKey( Inner, related_name="playlist", on_delete=models.CASCADE) channel_id = models.CharField(max_length=100, unique=True) channel_title = models.CharField(max_length=200, unique=True, blank=True) description = models.CharField(max_length=200, blank=True) type = models.CharField( max_length=10, choices=PLAYLIST_TYPE, default=HOT) email = models.CharField(max_length=100, blank=True) create_time = models.DateTimeField(auto_now_add=True) update_time = models.DateTimeField(auto_now=True) def __str__(self): return self.channel_title + ' ---- ' + self.inner.name
[ "wiwindson@outlook.com" ]
wiwindson@outlook.com
0889868667158ce67e7e7dff2559b9c9c4e29d70
f02cca2785c16a18e05fb9ccee40341c48cda9ec
/getprice.py
397320eca28c622b63e2a050559a390127488de9
[]
no_license
joshagoldstein/binance_notifications
b53045633855b0d40cc9268a3071a755b32cf90b
d58526f4d7695f9397ef20268c82d2ebcd511a5c
refs/heads/main
2023-05-03T10:29:24.320118
2021-05-08T08:37:58
2021-05-08T08:37:58
365,339,210
0
0
null
null
null
null
UTF-8
Python
false
false
1,769
py
from binance.client import Client import time t = time.localtime() current_time = time.strftime("%H:%M:%S", t) client = Client('3wfiKJWWSW42XSsSw0Y4fxm9iVHMaZeQFSyIMqn6RzAG8s33CpXW8rrr1J4TzC5m', 'o8BfTLXoa1evd5FpLn1TD1WqpRg3bGfvKSzwmta7a9T0afHe1SrEYJyb8qqSLw9w') #Get current price of each coin # info = client.get_all_tickers() # symbol=[] # for dictionaries in info: # ticker_price= list(dictionaries.values()) # if ticker_price[0][-4:]=='USDT': # new_val=ticker_price[0][0:-4]+'/'+'USDT' # ticker_price[0]=new_val # symbol.append(ticker_price) # symbol_sort=sorted(symbol, key=lambda x: float(x[1]), reverse=True) #for pair in symbol_sort: #print('The coin {} is currently valued at ${}'.format(pair[0],pair[1])) # print(symbol[0][0][:3]) info = client.get_ticker() tick_change={} for ind in info: if ind['symbol'][-4:]=='USDT': sym=ind['symbol'][0:-4]+'/'+'USDT' percent_change=float(ind['priceChangePercent']) tick_change[sym]=percent_change price=ind['lastPrice'] if percent_change < -5.0 or percent_change > 5.0: print("The coin {} has changed {}% over the past 24 hours and is currently ${} as of {}".format(sym,percent_change,price,current_time)) sorted_tick_change=sorted(tick_change.items(), key=lambda x: x[1], reverse=True) biggest_win=sorted_tick_change[0] biggest_loser=sorted_tick_change[-1] print('-'*100) print('The winner of the day is {} with a massive growth of {}%!'.format(biggest_win[0],biggest_win[1])) print('The WOAT of the day is {} with a piss poor performance of {}%!'.format(biggest_loser[0],biggest_loser[1])) #print(ind.keys()) #val=list(ind.values()) #print(val) #symbol, priceChange, priceChangePercent, lastPrice,
[ "noreply@github.com" ]
joshagoldstein.noreply@github.com
345a0494dccef9249e506fe626e36609d43e3f4a
9e4967f0bbe29ee3a78b1e6a1d153f2c7156be13
/tweetnacl_pure.py
6c073d28bf78e0eb981f2b956eb202c266828fea
[]
no_license
rofl0r/backdoor-py
981bf3fbd2bdd07ce3fe267ff3ad109d44ed9a84
2b0c65b86ee8af6a154ce2dbffc18a41a5332e66
refs/heads/master
2021-06-28T09:10:57.078374
2020-10-16T22:48:52
2020-10-16T22:48:52
176,001,354
7
1
null
null
null
null
UTF-8
Python
false
false
43,929
py
# -*- coding: utf-8 -*- """ taken from https://github.com/jfindlay/pure_pynacl Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import sys import os from array import array if sys.version_info < (2, 6): raise NotImplementedError('pure_pynacl requires python-2.6 or later') lt_py3 = sys.version_info < (3,) lt_py33 = sys.version_info < (3, 3) integer = long if lt_py3 else int # "constants" crypto_auth_hmacsha512256_tweet_BYTES = 32 crypto_auth_hmacsha512256_tweet_KEYBYTES = 32 crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES = 32 crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES = 32 crypto_box_curve25519xsalsa20poly1305_tweet_BEFORENMBYTES = 32 crypto_box_curve25519xsalsa20poly1305_tweet_NONCEBYTES = 24 crypto_box_curve25519xsalsa20poly1305_tweet_ZEROBYTES = 32 crypto_box_curve25519xsalsa20poly1305_tweet_BOXZEROBYTES = 16 crypto_core_salsa20_tweet_OUTPUTBYTES = 64 crypto_core_salsa20_tweet_INPUTBYTES = 16 crypto_core_salsa20_tweet_KEYBYTES = 32 crypto_core_salsa20_tweet_CONSTBYTES = 16 crypto_core_hsalsa20_tweet_OUTPUTBYTES = 32 crypto_core_hsalsa20_tweet_INPUTBYTES = 16 crypto_core_hsalsa20_tweet_KEYBYTES = 32 crypto_core_hsalsa20_tweet_CONSTBYTES = 16 crypto_hashblocks_sha512_tweet_STATEBYTES = 64 crypto_hashblocks_sha512_tweet_BLOCKBYTES = 128 crypto_hashblocks_sha256_tweet_STATEBYTES = 32 crypto_hashblocks_sha256_tweet_BLOCKBYTES = 64 crypto_hash_sha512_tweet_BYTES = 64 crypto_hash_sha256_tweet_BYTES = 32 crypto_onetimeauth_poly1305_tweet_BYTES = 16 crypto_onetimeauth_poly1305_tweet_KEYBYTES = 32 crypto_scalarmult_curve25519_tweet_BYTES = 32 crypto_scalarmult_curve25519_tweet_SCALARBYTES = 32 crypto_secretbox_xsalsa20poly1305_tweet_KEYBYTES = 32 crypto_secretbox_xsalsa20poly1305_tweet_NONCEBYTES = 24 crypto_secretbox_xsalsa20poly1305_tweet_ZEROBYTES = 32 crypto_secretbox_xsalsa20poly1305_tweet_BOXZEROBYTES = 16 crypto_sign_ed25519_tweet_BYTES = 64 crypto_sign_ed25519_tweet_PUBLICKEYBYTES = 32 crypto_sign_ed25519_tweet_SECRETKEYBYTES = 64 crypto_stream_xsalsa20_tweet_KEYBYTES = 32 crypto_stream_xsalsa20_tweet_NONCEBYTES = 24 crypto_stream_salsa20_tweet_KEYBYTES = 32 crypto_stream_salsa20_tweet_NONCEBYTES = 8 crypto_verify_16_tweet_BYTES = 16 crypto_verify_32_tweet_BYTES = 32 class TypeEnum(object): ''' order types used by pure_py(tweet)nacl for rapid type promotion ''' u8 = 1 u32 = 2 u64 = 3 Int = 5 i64 = 7 integer = 11 class Int(integer): ''' int types ''' bits = array('i').itemsize*8 mask = (1 << bits - 1) - 1 signed = True order = TypeEnum.Int def __str__(self): return integer.__str__(self) def __repr__(self): return 'Int(%s)' % integer.__repr__(self) def __new__(self, val=0): ''' ensure that new instances have the correct size and sign ''' if val < 0: residue = integer(-val) & self.mask if self.signed: residue = -residue else: residue = integer(val) & self.mask return integer.__new__(self, residue) def __promote_type(self, other, result): ''' determine the largest type from those in self and other; if result is negative and both self and other are unsigned, promote it to the least signed type ''' self_order = self.order other_order = other.order if isinstance(other, Int) else TypeEnum.integer if result < 0 and self_order < 5 and other_order < 5: return Int return self.__class__ if self_order > other_order else other.__class__ def __unary_typed(oper): ''' return a function that redefines the operation oper such that the result conforms to the type of self ''' def operate(self): ''' type the result to self ''' return self.__class__(oper(self)) return operate def __typed(oper): ''' return a function that redefines the operation oper such that the result conforms to the type of self or other, whichever is larger if both are strongly typed (have a bits attribute); otherwise return the result conforming to the type of self ''' def operate(self, other): ''' type and bitmask the result to either self or other, whichever is larger ''' result = oper(self, other) return self.__promote_type(other, result)(result) return operate def __shift(oper): ''' return a function that performs bit shifting, but preserves the type of the left value ''' def operate(self, other): ''' emulate C bit shifting ''' return self.__class__(oper(self, other)) return operate def __invert(): ''' return a function that performs bit inversion ''' def operate(self): ''' emulate C bit inversion ''' if self.signed: return self.__class__(integer.__invert__(self)) else: return self.__class__(integer.__xor__(self, self.mask)) return operate # bitwise operations __lshift__ = __shift(integer.__lshift__) __rlshift__ = __shift(integer.__rlshift__) __rshift__ = __shift(integer.__rshift__) __rrshift__ = __shift(integer.__rrshift__) __and__ = __typed(integer.__and__) __rand__ = __typed(integer.__rand__) __or__ = __typed(integer.__or__) __ror__ = __typed(integer.__ror__) __xor__ = __typed(integer.__xor__) __rxor__ = __typed(integer.__rxor__) __invert__ = __invert() # arithmetic operations if not lt_py3: __ceil__ = __unary_typed(integer.__ceil__) __floor__ = __unary_typed(integer.__floor__) __int__ = __unary_typed(integer.__int__) __abs__ = __unary_typed(integer.__abs__) __pos__ = __unary_typed(integer.__pos__) __neg__ = __unary_typed(integer.__neg__) __add__ = __typed(integer.__add__) __radd__ = __typed(integer.__radd__) __sub__ = __typed(integer.__sub__) __rsub__ = __typed(integer.__rsub__) __mod__ = __typed(integer.__mod__) __rmod__ = __typed(integer.__rmod__) __mul__ = __typed(integer.__mul__) __rmul__ = __typed(integer.__rmul__) if lt_py3: __div__ = __typed(integer.__div__) __rdiv__ = __typed(integer.__rdiv__) __floordiv__ = __typed(integer.__floordiv__) __rfloordiv__ = __typed(integer.__rfloordiv__) __pow__ = __typed(integer.__pow__) __rpow__ = __typed(integer.__rpow__) class IntArray(list): ''' arrays of int types ''' def __init__(self, typ, init=(), size=0): ''' create array of ints ''' self.typ = typ if lt_py3 and isinstance(init, bytes): init = [ord(i) for i in init] if size: init_size = len(init) if init_size < size: list.__init__(self, [typ(i) for i in init] + [typ() for i in range(size - init_size)]) else: list.__init__(self, [typ(i) for i in init[:size]]) else: list.__init__(self, [typ(i) for i in init]) def __str__(self): return list.__str__(self) def __repr__(self): return 'IntArray(%s, init=%s)' % (self.typ, list.__repr__(self)) class u8(Int): '''unsigned char''' bits = array('B').itemsize*8 mask = (1 << bits) - 1 signed = False order = TypeEnum.u8 def __repr__(self): return 'u8(%s)' % integer.__repr__(self) class u32(Int): '''unsigned long''' bits = array('L').itemsize*8 mask = (1 << bits) - 1 signed = False order = TypeEnum.u32 def __repr__(self): return 'u32(%s)' % integer.__repr__(self) class u64(Int): '''unsigned long long''' bits = array('L' if lt_py33 else 'Q').itemsize*8 mask = (1 << bits) - 1 signed = False order = TypeEnum.u64 def __repr__(self): return 'u64(%s)' % integer.__repr__(self) class i64(Int): '''long long''' bits = array('l' if lt_py33 else 'q').itemsize*8 mask = (1 << bits - 1) - 1 signed = True order = TypeEnum.i64 def __repr__(self): return 'i64(%s)' % integer.__repr__(self) class gf(IntArray): def __init__(self, init=()): IntArray.__init__(self, i64, init=init, size=16) def randombytes(c, s): ''' insert s random bytes into c ''' if lt_py3: c[:s] = bytearray(os.urandom(s)) else: c[:s] = os.urandom(s) _0 = IntArray(u8, size=16) _9 = IntArray(u8, size=32, init=[9]) gf0 = gf() gf1 = gf([1]) _121665 = gf([0xDB41, 1]) D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]) D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]) X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]) Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]) I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]) def L32(x, c): '''static u32 L32(u32 x, int c)''' return (u32(x) << c) | ((u32(x) & 0xffffffff) >> (32 - c)) def ld32(x): '''u32 ld32(const u8*x)''' u = u32(x[3]) u = (u << 8) | u32(x[2]) u = (u << 8) | u32(x[1]) return (u << 8) | u32(x[0]) def dl64(x): '''u64 dl64(const u8*x)''' u = u64() for i in range(8): u = (u << 8) | u8(x[i]) return u def st32(x, u): '''void st32(u8*x, u32 u)''' for i in range(4): x[i] = u8(u); u >>= 8 return x def ts64(x, u): '''void ts64(u8*x, u64 u)''' for i in range(7, -1, -1): x[i] = u8(u); u >>= 8 return x def vn(x, y, n): '''int vn(const u8*x, const u8*y, int n)''' d = u32() for i in range(n): d |= x[i] ^ y[i] return (1 & ((d - 1) >> 8)) - 1 def crypto_verify_16_tweet(x, y): '''int crypto_verify_16_tweet(const u8*x, const u8*y)''' return vn(x, y, 16) def crypto_verify_32_tweet(x, y): '''int crypto_verify_32_tweet(const u8*x, const u8*y)''' return vn(x, y, 32) def core(out, in_, k, c, h): '''void core(u8*out, const u8*in, const u8*k, const u8*c, int h)''' w = IntArray(u32, size=16) x = IntArray(u32, size=16) y = IntArray(u32, size=16) t = IntArray(u32, size=4) for i in range(4): x[5*i] = ld32(c[4*i:]) x[1 + i] = ld32(k[4*i:]) x[6 + i] = ld32(in_[4*i:]) x[11 + i] = ld32(k[16 + 4*i:]) for i in range(16): y[i] = x[i] for i in range(20): for j in range(4): for m in range(4): t[m] = x[(5*j + 4*m)%16] t[1] ^= L32(t[0] + t[3], 7) t[2] ^= L32(t[1] + t[0], 9) t[3] ^= L32(t[2] + t[1],13) t[0] ^= L32(t[3] + t[2],18) for m in range(4): w[4*j + (j + m)%4] = t[m] for m in range(16): x[m] = w[m] if h: for i in range(16): x[i] += y[i] for i in range(4): x[5*i] -= ld32(c[4*i:]) x[6+i] -= ld32(in_[4*i:]) for i in range(4): out[4*i:] = st32(out[4*i:], x[5*i]) out[16 + 4*i:] = st32(out[16 + 4*i:], x[6 + i]) else: for i in range(16): out[4*i:] = st32(out[4*i:], x[i] + y[i]) def crypto_core_salsa20_tweet(out, in_, k, c): '''int crypto_core_salsa20_tweet(u8*out, const u8*in, const u8*k, const u8*c)''' core(out, in_, k, c, False) return 0 def crypto_core_hsalsa20_tweet(out, in_, k, c): '''int crypto_core_hsalsa20_tweet(u8*out, const u8*in, const u8*k, const u8*c)''' core(out, in_, k, c, True) return 0 sigma = IntArray(u8, size=16, init=b'expand 32-byte k') def crypto_stream_salsa20_tweet_xor(c, m, b, n, k): '''int crypto_stream_salsa20_tweet_xor(u8*c, const u8*m, u64 b, const u8*n, const u8*k)''' z = IntArray(u8, size=16) x = IntArray(u8, size=64) if not b: return 0 for i in range(8): z[i] = n[i] c_off = 0 ; m_off = 0 while b >= 64: crypto_core_salsa20_tweet(x, z, k, sigma) for i in range(64): c[i + c_off] = (m[i + m_off] if m else 0) ^ x[i] u = u32(1) for i in range(8, 16): u += u32(z[i]) z[i] = u u >>= 8 b -= 64 c_off += 64 if m: m_off += 64 if b: crypto_core_salsa20_tweet(x, z, k, sigma) for i in range(b): c[i + c_off] = (m[i + m_off] if m else 0) ^ x[i] return 0 def crypto_stream_salsa20_tweet(c, d, n, k): '''int crypto_stream_salsa20_tweet(u8*c, u64 d, const u8*n, const u8*k)''' return crypto_stream_salsa20_tweet_xor(c, IntArray(u8), d, n, k) def crypto_stream_xsalsa20_tweet(c, d, n, k): '''int crypto_stream_xsalsa20_tweet(u8*c, u64 d, const u8*n, const u8*k)''' s = IntArray(u8, size=32) crypto_core_hsalsa20_tweet(s, n, k, sigma) return crypto_stream_salsa20_tweet(c, d, n[16:], s) def crypto_stream_xsalsa20_tweet_xor(c, m, d, n, k): '''int crypto_stream_xsalsa20_tweet_xor(u8*c, const u8*m, u64 d, const u8*n, const u8*k)''' s = IntArray(u8, size=32) crypto_core_hsalsa20_tweet(s, n, k, sigma) return crypto_stream_salsa20_tweet_xor(c, m, d, n[16:], s) def add1305(h, c): '''void add1305(u32*h, const u32*c)''' u = u32() for j in range(17): u += u32(h[j] + c[j]) h[j] = u & 255 u >>= 8 minusp = IntArray(u32, size=17, init=(5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252)) def crypto_onetimeauth_poly1305_tweet(out, m, n, k): '''int crypto_onetimeauth_poly1305_tweet(u8*out, const u8*m, u64 n, const u8*k)''' s = u32() u = u32() x = IntArray(u32, size=17) r = IntArray(u32, size=17) h = IntArray(u32, size=17) c = IntArray(u32, size=17) g = IntArray(u32, size=17) for j in range(16): r[j] = k[j] r[3] &= 15 r[4] &= 252 r[7] &= 15 r[8] &= 252 r[11] &= 15 r[12] &= 252 r[15] &= 15 while n > 0: c[:17] = 17*[u32()] for j in range(16): if j >= n: j -= 1 ; break c[j] = m[j] j += 1 c[j] = 1 m = m[j:]; n -= j add1305(h, c) for i in range(17): x[i] = 0 for j in range(17): x[i] += h[j]*(r[i - j] if j <= i else 320*r[i + 17 - j]) for i in range(17): h[i] = x[i] u = 0 for j in range(16): u += h[j] h[j] = u & 255 u >>= 8 u += h[16]; h[16] = u & 3 u = 5*(u >> 2) for j in range(16): u += h[j] h[j] = u & 255 u >>= 8 u += h[16]; h[16] = u for j in range(17): g[j] = h[j] add1305(h, minusp) s = -(h[16] >> 7) for j in range(17): h[j] ^= s & (g[j] ^ h[j]) for j in range(16): c[j] = k[j + 16] c[16] = 0 add1305(h, c) for j in range(16): out[j] = h[j] return 0 def crypto_onetimeauth_poly1305_tweet_verify(h, m, n, k): '''int crypto_onetimeauth_poly1305_tweet_verify(const u8*h, const u8*m, u64 n, const u8*k)''' x = IntArray(u8, size=16) crypto_onetimeauth_poly1305_tweet(x, m, n, k) return crypto_verify_16_tweet(h, x) def crypto_secretbox_xsalsa20poly1305_tweet(c, m, d, n, k): '''int crypto_secretbox_xsalsa20poly1305_tweet(u8*c, const u8*m, u64 d, const u8*n, const u8*k)''' if d < 32: return -1 crypto_stream_xsalsa20_tweet_xor(c, m, d, n, k) c_out = c[16:] crypto_onetimeauth_poly1305_tweet(c_out, c[32:], d - 32, c) c[16:] = c_out c[:16] = 16*[u8()] return 0 def crypto_secretbox_xsalsa20poly1305_tweet_open(m, c, d, n, k): '''int crypto_secretbox_xsalsa20poly1305_tweet_open(u8*m, const u8*c, u64 d, const u8*n, const u8*k)''' x = IntArray(u8, size=32) if d < 32: return -1 crypto_stream_xsalsa20_tweet(x, 32, n, k) if crypto_onetimeauth_poly1305_tweet_verify(c[16:], c[32:], d - 32, x) != 0: return -1 crypto_stream_xsalsa20_tweet_xor(m, c, d, n, k) m[:32] = 32*[u8()] return 0 def set25519(r, a): '''void set25519(gf r, const gf a)''' for i in range(16): r[i] = a[i] def car25519(o): '''void car25519(gf o)''' c = i64() for i in range(16): o[i] += (i64(1) << 16) c = o[i] >> 16 o[(i + 1)*(i < 15)] += c - 1 + 37*(c - 1)*(i == 15) o[i] -= c << 16 def sel25519(p, q, b): '''void sel25519(gf p, gf q, int b)''' t = i64() c = i64(~(b - 1)) for i in range(16): t = c & (p[i] ^ q[i]) p[i] ^= t q[i] ^= t return p, q def pack25519(o, n): '''void pack25519(u8*o, const gf n)''' b = int() m = gf() t = gf() for i in range(16): t[i] = n[i] car25519(t) car25519(t) car25519(t) for j in range(2): m[0] = t[0] - 0xffed for i in range(1,15): m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1) m[i-1] &= 0xffff m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1) b = (m[15] >> 16) & 1 m[14] &= 0xffff sel25519(t, m, 1 - b) for i in range(16): o[2*i] = t[i] & 0xff o[2*i + 1] = t[i] >> 8 def neq25519(a, b): '''int neq25519(const gf a, const gf b)''' c = IntArray(u8, size=32) d = IntArray(u8, size=32) pack25519(c, a) pack25519(d, b) return crypto_verify_32_tweet(c, d) def par25519(a): '''u8 par25519(const gf a)''' d = IntArray(u8, size=32) pack25519(d, a) return d[0] & 1 def unpack25519(o, n): '''void unpack25519(gf o, const u8*n)''' for i in range(16): o[i] = n[2*i] + (i64(n[2*i + 1]) << 8) o[15] &= 0x7fff def A(o, a, b): '''void A(gf o, const gf a, const gf b)''' for i in range(16): o[i] = a[i] + b[i] def Z(o, a, b): '''void Z(gf o, const gf a, const gf b)''' for i in range(16): o[i] = a[i] - b[i] def M(o, a, b): '''void M(gf o, const gf a, const gf b)''' t = IntArray(i64, size=31) for i in range(16): for j in range(16): t[i + j] += a[i]*b[j] for i in range(15): t[i] += 38*t[i + 16] for i in range(16): o[i] = t[i] car25519(o) car25519(o) return o def S(o, a): '''void S(gf o, const gf a)''' M(o, a, a) def inv25519(o, i): '''void inv25519(gf o, const gf i)''' c = gf() for a in range(16): c[a] = i[a] for a in range(253, -1, -1): S(c, c) if a != 2 and a != 4: M(c, c, i) for a in range(16): o[a] = c[a] return o def pow2523(o, i): '''void pow2523(gf o, const gf i)''' c = gf() for a in range(16): c[a] = i[a] for a in range(250, -1, -1): S(c, c) if a != 1: M(c, c, i) for a in range(16): o[a] = c[a] def crypto_scalarmult_curve25519_tweet(q, n, p): '''int crypto_scalarmult_curve25519_tweet(u8*q, const u8*n, const u8*p)''' z = IntArray(u8, size=32) x = IntArray(i64, size=80) r = i64() a = gf() b = gf() c = gf() d = gf() e = gf() f = gf() for i in range(31): z[i] = n[i] z[31] = (n[31] & 127) | 64 z[0] &= 248 unpack25519(x, p) for i in range(16): b[i] = x[i] d[i] = a[i] = c[i] = 0 a[0] = d[0] = 1 for i in range(254, -1, -1): r = (z[i >> 3] >> (i & 7)) & 1 sel25519(a, b, r) sel25519(c, d, r) A(e, a, c) Z(a, a, c) A(c, b, d) Z(b, b, d) S(d, e) S(f, a) M(a, c, a) M(c, b, e) A(e, a, c) Z(a, a, c) S(b, a) Z(c, d, f) M(a, c, _121665) A(a, a, d) M(c, c, a) M(a, d, f) M(d, b, x) S(b, e) sel25519(a, b, r) sel25519(c, d, r) for i in range(16): x[i + 16] = a[i] x[i + 32] = c[i] x[i + 48] = b[i] x[i + 64] = d[i] x[32:] = inv25519(x[32:], x[32:]) x[16:] = M(x[16:], x[16:], x[32:]) pack25519(q, x[16:]) return 0 def crypto_scalarmult_curve25519_tweet_base(q, n): '''int crypto_scalarmult_curve25519_tweet_base(u8*q, const u8*n)''' return crypto_scalarmult_curve25519_tweet(q, n, _9) def crypto_box_curve25519xsalsa20poly1305_tweet_keypair(y, x): '''int crypto_box_curve25519xsalsa20poly1305_tweet_keypair(u8*y, u8*x)''' randombytes(x, 32) return crypto_scalarmult_curve25519_tweet_base(y, x) def crypto_box_curve25519xsalsa20poly1305_tweet_beforenm(k, y, x): '''int crypto_box_curve25519xsalsa20poly1305_tweet_beforenm(u8*k, const u8*y, const u8*x)''' s = IntArray(u8, size=32) crypto_scalarmult_curve25519_tweet(s, x, y) return crypto_core_hsalsa20_tweet(k, _0, s, sigma) def crypto_box_curve25519xsalsa20poly1305_tweet_afternm(c, m, d, n, k): '''int crypto_box_curve25519xsalsa20poly1305_tweet_afternm(u8*c, const u8*m, u64 d, const u8*n, const u8*k)''' return crypto_secretbox_xsalsa20poly1305_tweet(c, m, d, n, k) def crypto_box_curve25519xsalsa20poly1305_tweet_open_afternm(m, c, d, n, k): '''int crypto_box_curve25519xsalsa20poly1305_tweet_open_afternm(u8*m, const u8*c, u64 d, const u8*n, const u8*k)''' return crypto_secretbox_xsalsa20poly1305_tweet_open(m, c, d, n, k) def crypto_box_curve25519xsalsa20poly1305_tweet(c, m, d, n, y, x): '''int crypto_box_curve25519xsalsa20poly1305_tweet(u8*c, const u8*m, u64 d, const u8*n, const u8*y, const u8*x)''' k = IntArray(u8, size=32) crypto_box_curve25519xsalsa20poly1305_tweet_beforenm(k, y, x) return crypto_box_curve25519xsalsa20poly1305_tweet_afternm(c, m, d, n, k) def crypto_box_curve25519xsalsa20poly1305_tweet_open(m, c, d, n, y, x): '''int crypto_box_curve25519xsalsa20poly1305_tweet_open(u8*m, const u8*c, u64 d, const u8*n, const u8*y, const u8*x)''' k = IntArray(u8, size=32) crypto_box_curve25519xsalsa20poly1305_tweet_beforenm(k, y, x) return crypto_box_curve25519xsalsa20poly1305_tweet_open_afternm(m, c, d, n, k) def R(x, c): '''u64 R(u64 x, int c)''' return (u64(x) >> c) | (u64(x) << (64 - c)) def Ch(x, y, z): '''u64 Ch(u64 x, u64 y, u64 z)''' return (u64(x) & u64(y)) ^ (~u64(x) & u64(z)) def Maj(x, y, z): '''u64 Maj(u64 x, u64 y, u64 z)''' return (u64(x) & u64(y)) ^ (u64(x) & u64(z)) ^ (u64(y) & u64(z)) def Sigma0(x): '''u64 Sigma0(u64 x)''' return R(x, 28) ^ R(x, 34) ^ R(x, 39) def Sigma1(x): '''u64 Sigma1(u64 x)''' return R(x, 14) ^ R(x, 18) ^ R(x, 41) def sigma0(x): '''u64 sigma0(u64 x)''' return R(x, 1) ^ R(x, 8) ^ (x >> 7) def sigma1(x): '''u64 sigma1(u64 x)''' return R(x, 19) ^ R(x, 61) ^ (x >> 6) K = IntArray(u64, size=80, init=[ 0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235, 0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65, 0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5, 0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725, 0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b, 0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218, 0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8, 0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec, 0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b, 0xca273eceea26619c, 0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b, 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817 ]) def crypto_hashblocks_sha512_tweet(x, m, n): '''int crypto_hashblocks_sha512_tweet(u8*x, const u8*m, u64 n)''' z = IntArray(u64, size=8) b = IntArray(u64, size=8) a = IntArray(u64, size=8) w = IntArray(u64, size=16) t = u64() for i in range(8): z[i] = a[i] = dl64(x[8*i:]) m_off = 0 while n >= 128: for i in range(16): w[i] = dl64(m[8*i + m_off:]) for i in range(80): for j in range(8): b[j] = a[j] t = a[7] + Sigma1(a[4]) + Ch(a[4], a[5], a[6]) + K[i] + w[i%16] b[7] = t + Sigma0(a[0]) + Maj(a[0], a[1], a[2]) b[3] += t for j in range(8): a[(j + 1)%8] = b[j] if i%16 == 15: for j in range(16): w[j] += w[(j + 9)%16] + sigma0(w[(j + 1)%16]) + sigma1(w[(j + 14)%16]) for i in range(8): a[i] += z[i]; z[i] = a[i] m_off += 128 n -= 128 for i in range(8): x[8*i:] = ts64(x[8*i:], z[i]) return n iv = IntArray(u8, size=64, init=[ 0x6a, 0x09, 0xe6, 0x67, 0xf3, 0xbc, 0xc9, 0x08, 0xbb, 0x67, 0xae, 0x85, 0x84, 0xca, 0xa7, 0x3b, 0x3c, 0x6e, 0xf3, 0x72, 0xfe, 0x94, 0xf8, 0x2b, 0xa5, 0x4f, 0xf5, 0x3a, 0x5f, 0x1d, 0x36, 0xf1, 0x51, 0x0e, 0x52, 0x7f, 0xad, 0xe6, 0x82, 0xd1, 0x9b, 0x05, 0x68, 0x8c, 0x2b, 0x3e, 0x6c, 0x1f, 0x1f, 0x83, 0xd9, 0xab, 0xfb, 0x41, 0xbd, 0x6b, 0x5b, 0xe0, 0xcd, 0x19, 0x13, 0x7e, 0x21, 0x79 ]) def crypto_hash_sha512_tweet(out, m, n): '''int crypto_hash_sha512_tweet(u8*out, const u8*m, u64 n)''' h = IntArray(u8, size=64) x = IntArray(u8, size=256) b = u64(n) for i in range(64): h[i] = iv[i] crypto_hashblocks_sha512_tweet(h, m, n) m_off = n n &= 127 m_off -= n x[:256] = 256*[u8()] for i in range(n): x[i] = m[i + m_off] x[n] = 128 n = 256 - 128*(n < 112) x[n - 9] = b >> 61 x[n - 8:] = ts64(x[n - 8:], b << 3) crypto_hashblocks_sha512_tweet(h, x, n) for i in range(64): out[i] = h[i] return 0 def add(p, q): '''void add(gf p[4], gf q[4])''' a = gf() b = gf() c = gf() d = gf() t = gf() e = gf() f = gf() g = gf() h = gf() Z(a, p[1], p[0]) Z(t, q[1], q[0]) M(a, a, t) A(b, p[0], p[1]) A(t, q[0], q[1]) M(b, b, t) M(c, p[3], q[3]) M(c, c, D2) M(d, p[2], q[2]) A(d, d, d) Z(e, b, a) Z(f, d, c) A(g, d, c) A(h, b, a) M(p[0], e, f) M(p[1], h, g) M(p[2], g, f) M(p[3], e, h) def cswap(p, q, b): '''void cswap(gf p[4], gf q[4], u8 b)''' for i in range(4): p[i], q[i] = sel25519(p[i], q[i], b) def pack(r, p): '''void pack(u8*r, gf p[4])''' tx = gf() ty = gf() zi = gf() inv25519(zi, p[2]) M(tx, p[0], zi) M(ty, p[1], zi) pack25519(r, ty) r[31] ^= par25519(tx) << 7 def scalarmult(p, q, s): '''void scalarmult(gf p[4], gf q[4], const u8*s)''' set25519(p[0], gf0) set25519(p[1], gf1) set25519(p[2], gf1) set25519(p[3], gf0) for i in range(255, -1, -1): b = u8((s[i//8] >> (i & 7)) & 1) cswap(p, q, b) add(q, p) add(p, p) cswap(p, q, b) def scalarbase(p, s): '''void scalarbase(gf p[4], const u8*s)''' q = [gf() for i in range(4)] set25519(q[0], X) set25519(q[1], Y) set25519(q[2], gf1) M(q[3], X, Y) scalarmult(p, q, s) def crypto_sign_ed25519_tweet_keypair(pk, sk): '''int crypto_sign_ed25519_tweet_keypair(u8*pk, u8*sk)''' d = IntArray(u8, size=64) p = [gf() for i in range(4)] randombytes(sk, 32) crypto_hash_sha512_tweet(d, sk, 32) d[0] &= 248 d[31] &= 127 d[31] |= 64 scalarbase(p, d) pack(pk, p) for i in range(32): sk[32 + i] = pk[i] return 0 L = IntArray(u64, size=32, init=[ 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10 ]) def modL(r, x): '''void modL(u8*r, i64 x[64])''' carry = i64() for i in range(63, 31, -1): carry = 0 for j in range(i - 32, i - 12): x[j] += carry - 16*x[i]*L[j - (i - 32)] carry = (x[j] + 128) >> 8 x[j] -= carry << 8 j += 1 x[j] += carry x[i] = 0 carry = 0 for j in range(32): x[j] += carry - (x[31] >> 4)*L[j] carry = x[j] >> 8 x[j] &= 255 for j in range(32): x[j] -= carry*L[j] for i in range(32): x[i + 1] += x[i] >> 8 r[i] = x[i] & 255 return r def reduce(r): '''void reduce(u8*r)''' x = IntArray(i64, size=64) for i in range(64): x[i] = u64(r[i]) r[:64] = 64*[u8()] modL(r, x) def crypto_sign_ed25519_tweet(sm, smlen, m, n, sk): '''int crypto_sign_ed25519_tweet(u8*sm, u64*smlen, const u8*m, u64 n, const u8*sk)''' d = IntArray(u8, size=64) h = IntArray(u8, size=64) r = IntArray(u8, size=64) x = IntArray(i64, size=64) p = [gf() for i in range(4)] crypto_hash_sha512_tweet(d, sk, 32) d[0] &= 248 d[31] &= 127 d[31] |= 64 # There is no (simple?) way to return this argument's value back to the # user in python. Rather than redefining the return value of this function # it is better to advise the user that ``smlen`` does not work as it does # in the C implementation and that its value will be equal to ``n + 64``. smlen = n + 64 for i in range(n): sm[64 + i] = m[i] for i in range(32): sm[32 + i] = d[32 + i] crypto_hash_sha512_tweet(r, sm[32:], n + 32) reduce(r) scalarbase(p, r) pack(sm, p) for i in range(32): sm[i + 32] = sk[i + 32] crypto_hash_sha512_tweet(h, sm, n + 64) reduce(h) for i in range(64): x[i] = 0 for i in range(32): x[i] = u64(r[i]) for i in range(32): for j in range(32): x[i + j] += h[i]*u64(d[j]) sm[32:] = modL(sm[32:], x) return 0 def unpackneg(r, p): '''int unpackneg(gf r[4], const u8 p[32])''' t = gf() chk = gf() num = gf() den = gf() den2 = gf() den4 = gf() den6 = gf() set25519(r[2], gf1) unpack25519(r[1], p) S(num, r[1]) M(den, num, D) Z(num, num, r[2]) A(den, r[2], den) S(den2, den) S(den4, den2) M(den6, den4, den2) M(t, den6, num) M(t, t, den) pow2523(t, t) M(t, t, num) M(t, t, den) M(t, t, den) M(r[0], t, den) S(chk, r[0]) M(chk, chk, den) if neq25519(chk, num): M(r[0], r[0], I) S(chk, r[0]) M(chk, chk, den) if neq25519(chk, num): return -1 if par25519(r[0]) == (p[31] >> 7): Z(r[0], gf0, r[0]) M(r[3], r[0], r[1]) return 0 def crypto_sign_ed25519_tweet_open(m, mlen, sm, n, pk): '''int crypto_sign_ed25519_tweet_open(u8*m, u64*mlen, const u8*sm, u64 n, const u8*pk)''' t = IntArray(u8, size=32) h = IntArray(u8, size=64) p = [gf() for i in range(4)] q = [gf() for i in range(4)] mlen = -1 if n < 64: return -1 if unpackneg(q, pk): return -1 for i in range(n): m[i] = sm[i] for i in range(32): m[i + 32] = pk[i] crypto_hash_sha512_tweet(h, m, n) reduce(h) scalarmult(p, q, h) scalarbase(q, sm[32:]) add(p, q) pack(t, p) n -= 64 if crypto_verify_32_tweet(sm, t): for i in range(n): m[i] = 0 return -1 for i in range(n): m[i] = sm[i + 64] # There is no (simple?) way to return this argument's value back to the # user in python. Rather than redefining the return value of this function # it is better to advise the user that ``mlen`` does not work as it does in # the C implementation and that its value will be equal to ``-1`` if ``n < # 64`` or decryption fails and ``n - 64`` otherwise. mlen = n return 0
[ "rofl0r@users.noreply.github.com" ]
rofl0r@users.noreply.github.com
337fc9acd874ec2fe78a22c97a899891aa30bc6e
cac5c5fc82a6f1a377786bca731996bbb6d67e70
/lab8/perceptron.py
6eef9b9e40d9d9237973383b3e6b92244c5d9d8e
[]
no_license
njordan3/Artificial-Intelligence
db81cfe92d28fe9a14b438140ac387587c892200
a63f7d91e4fb8f1a36738a7999819c53870f2d04
refs/heads/master
2022-08-27T16:53:17.638856
2020-05-20T15:24:49
2020-05-20T15:24:49
265,606,840
0
0
null
null
null
null
UTF-8
Python
false
false
1,649
py
# Author: Nicholas Jordan # Date: 4/7/20 # Lab 8: Perceptron Learning Algorithm Using Fisher's Iris Dataset import csv from random import seed from random import random filename = "iris.csv" array = [] with open(filename, newline='') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') for row in csvreader: row = [float(i) for i in row] array.append(row) # simple 'expert system' that each sample runs through to get accuracy of the data counter = 0 for row in array: if row[2] > 0 and row[4] == -1: counter+=1 accuracy = round(counter/len(array),2) print("CSV species accuracy: {}%".format(accuracy*100)) # learning rate: small change to 'w' that gets made when the algorithm guesses wrong alpha = 0.05 # seed random number generator seed(1) # 4 weights of random value to make guesses #w = [random() for i in range(4)] #theta = random() w = [0,0,0,0] theta = 0 # an epoch is a run through the whole dataset for epoch in range(100): errors = 0 for sample in array: x = sample[:4] yd = sample[4] # feed forward charge = x[0]*w[0] + x[1]*w[1] + x[2]*w[2] + x[3]*w[3] - theta #print(charge, w[0], w[1], w[2], w[3], theta) # sign activation function if charge <= 0: guess = -1 else: guess = 1 # error correction e = yd - guess if e != 0: for j in range(4): w[j] = w[j] + alpha * x[j] * e theta = theta + alpha * e * -1 errors+=1 print("EPOCH {}: Accuracy is {}%".format(epoch+1, round((len(array) - errors)/len(array)*100, 2)))
[ "noreply@github.com" ]
njordan3.noreply@github.com
f321eb6f45926063501fb2e517aa62032f931345
16516732031deb7f7e074be9fe757897557eee2d
/AtCoder/ABC144/B - 81.py
20cb27b770682ca06d845b8961d895932b2f6ea9
[]
no_license
cale-i/atcoder
90a04d3228864201cf63c8f8fae62100a19aefa5
c21232d012191ede866ee4b9b14ba97eaab47ea9
refs/heads/master
2021-06-24T13:10:37.006328
2021-03-31T11:41:59
2021-03-31T11:41:59
196,288,266
0
0
null
null
null
null
UTF-8
Python
false
false
172
py
# 2019/10/29 n=int(input()) for i in range(1,10): for j in range(1,10): if n==i*j: print('Yes') exit() else: print('No')
[ "calei078029@gmail.com" ]
calei078029@gmail.com
dc507a14aa2d66870ccc251aaa3639821fae136b
d1b27a90037b3b7ad5a14cf77d28b6313104d8c5
/backend/users/tasks.py
191013ed3960dff89e30bbfabd4955c4a9537763
[ "MIT" ]
permissive
zepplinsbass/imperial_assault
66ad08c8dddc56e9300fbf33a597e2ce503b0ead
b6bd0ecef15962978308269f909573bef1c05bfc
refs/heads/main
2023-04-14T03:53:48.455018
2021-04-20T13:23:58
2021-04-20T13:23:58
355,036,618
0
0
null
null
null
null
UTF-8
Python
false
false
161
py
from django.core import management from imperial-assault import celery_app @celery_app.task def clearsessions(): management.call_command('clearsessions')
[ "zepplinsbass@gmail.com" ]
zepplinsbass@gmail.com
ed0549291501f587e1235fcff85f3db9dc1f164c
358b5a026e0865af26bb1abd451b8a55bc478f11
/Scripts/ClassifyMibigTsv.py
67e1859ae98150ba7335b4c93ed18b375112aea3
[]
no_license
OscarHoekstra/ClassifyNPDB
0a38599f6e23d8af8748ed36a960f2024cee699b
2fd2e30e16cabc324d2d1c17e692bc609c2e94df
refs/heads/master
2020-04-18T13:44:06.499639
2019-03-22T11:21:41
2019-03-22T11:21:41
167,569,325
2
1
null
null
null
null
UTF-8
Python
false
false
1,754
py
#!/usr/bin/env python3 """ Author: Oscar Hoekstra Student Number: 961007346130 Email: oscarhoekstra@wur.nl Description: Loads a TSV file with mibig compound-id, compound name and smile strings, uploads the smiles to ClassyFire and creates a dictionary with the compound id and name with the QueryID to retrieve the classification later. """ import sys from Scripts import Run_pyclassyfire4 import pickle def LoadMibigTsv(InFile): """ Loads a tsv file with all smiles available for the mibig dataset and saves the mibig accession and compound-name as CompoundID and the smile as Structure in a dictionary CompoundDict """ CompoundDict = {} with open(InFile, 'r') as f: f.readline() File = f.readlines() for line in File: line = line.split('\t') CompoundID = line[0]+"_"+line[1] Structure = line[2] if CompoundID in CompoundDict: print('THIS SHOULD NOT HAPPEN,', 'There seems to be a duplicate in the mibig smile tsv file,', 'Check the file for errors!') print(CompoundID) exit(1) if len(Structure) > 0: CompoundDict[CompoundID] = Structure return CompoundDict def main(InFile): # Create a dictionary with the mibig compounds and smiles. CompoundDict = LoadMibigTsv(InFile) QueryIDDict = Run_pyclassyfire4.PyClassifyStructureList(CompoundDict) with open("PickledQueryIDDict.txt",'wb') as f: pickle.dump(QueryIDDict, f) print("Saved PickledQueryIDDict") #Run_pyclassyfire4.GetPyclassyfireResults(QueryIDDict) if __name__ == "__main__": InFile = sys.argv[1] main(InFile) print("Done")
[ "oscar.hoekstra@wur.nl" ]
oscar.hoekstra@wur.nl
dcd45071d9de9c2cd68da8c294b12261666ef0c7
82fce9aae9e855a73f4e92d750e6a8df2ef877a5
/Lab/venv/lib/python3.8/site-packages/OpenGL/WGL/I3D/swap_frame_lock.py
55165c5511d39959c40ce8e2e34740a4e67b88d3
[]
no_license
BartoszRudnik/GK
1294f7708902e867dacd7da591b9f2e741bfe9e5
6dc09184a3af07143b9729e42a6f62f13da50128
refs/heads/main
2023-02-20T19:02:12.408974
2021-01-22T10:51:14
2021-01-22T10:51:14
307,847,589
0
0
null
null
null
null
UTF-8
Python
false
false
574
py
'''OpenGL extension I3D.swap_frame_lock This module customises the behaviour of the OpenGL.raw.WGL.I3D.swap_frame_lock to provide a more Python-friendly API The official definition of this extension is available here: http://www.opengl.org/registry/specs/I3D/swap_frame_lock.txt ''' from OpenGL.raw.WGL.I3D.swap_frame_lock import _EXTENSION_NAME def glInitSwapFrameLockI3D(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME ) ### END AUTOGENERATED SECTION
[ "rudnik49@gmail.com" ]
rudnik49@gmail.com
354b8e8c9970c9f648bc4121fee221c159995f3d
356c00aed4c9e45d5b9cae067dcb8d1bbb09cb1d
/backend/src/paruzorus/web/__init__.py
182b8bdfe777d6f98b52d8d8ae2f3b4e16ac1fe0
[]
no_license
TwistedSim/Paruzorus
74fedd97696114918021daa3117c2e7ce8d6038a
e857881d0d9d359b677e3cc4bc7a9c79019ae097
refs/heads/master
2023-08-15T09:27:33.943014
2021-09-14T16:41:20
2021-09-14T16:41:20
349,588,484
1
0
null
null
null
null
UTF-8
Python
false
false
1,063
py
import base64 from logging import getLogger from aiohttp import web from aiohttp_middlewares import cors_middleware, error_middleware from aiohttp_session import setup from aiohttp_session.cookie_storage import EncryptedCookieStorage from cryptography import fernet from paruzorus.controllers.quiz_controller import QuizController from paruzorus.providers.macaulay import MacAulayProvider from paruzorus.species.sandpipers import TARGET_SPECIES from paruzorus.web.api import create_api logger = getLogger(__name__) async def create_app(): app = web.Application( middlewares=( cors_middleware(allow_all=True), error_middleware(), ) ) fernet_key = fernet.Fernet.generate_key() secret_key = base64.urlsafe_b64decode(fernet_key) setup(app, EncryptedCookieStorage(secret_key)) provider = MacAulayProvider(TARGET_SPECIES) app["quiz_controller"] = QuizController(provider) api = await create_api() app.add_subapp("/api", api) logger.debug("App creation completed") return app
[ "bouchards@amotus.ca" ]
bouchards@amotus.ca
3776da41918b7c075ae74dc769b3cd91266c96a7
92662baf27ff293ea9dc4ef84ef6e9f60a3683b2
/BillBoard/user/views.py
d74b680769dba014a2f98f8b8590538a6b9f6ea8
[]
no_license
AleenaVarghese/BillBoard
3a3dc21946f4a3a52d42182f2bc1a9c1eabdce42
0cb7c9259eb351fe1ca3d54bb3e5c87cce62584e
refs/heads/master
2020-06-23T21:44:55.884861
2019-07-25T05:20:11
2019-07-25T05:20:11
198,760,393
0
0
null
null
null
null
UTF-8
Python
false
false
2,569
py
from django.shortcuts import render from boards.models import BillBoard from django.views.generic import CreateView, ListView, DetailView, DeleteView, UpdateView from .forms import BillBoardForm, BillBoardUpdateForm from django.urls import reverse_lazy from django.shortcuts import get_object_or_404 from boards.choices import * from django import forms from django.contrib.auth.mixins import LoginRequiredMixin # Create your views here. class BillBordListView(LoginRequiredMixin, ListView): model = BillBoard template_name = 'user/home.html' # <app>/<model>_<viewtype>.html queryset = BillBoard.objects.all() context_object_name = 'BillBord_list' paginate_by = 3 ordering = ['city'] def get_queryset(self): return BillBoard.objects.all().order_by('city') class BillBoardCreateView(LoginRequiredMixin, CreateView): model = BillBoard template_name = 'user/addnew.html' form_class = BillBoardForm success_url = reverse_lazy('user:BillBord_list') class BillBoardDeleteView(LoginRequiredMixin, DeleteView): model = BillBoard success_url = reverse_lazy('user:BillBord_list') class BillBoardUpdateView(LoginRequiredMixin, UpdateView): model = BillBoard form_class = BillBoardUpdateForm template_name = 'user/EditBillBoard.html' success_url = reverse_lazy('user:BillBord_list') def form_valid(self, form): return super(BillBoardUpdateView, self).form_valid(form) class BillBordSearchView(LoginRequiredMixin, ListView): model = BillBoard template_name = 'user/SearchBillBoard.html' # <app>/<model>_<viewtype>.html context_object_name = 'BillBord_list' def get_queryset(self): search_query = self.request.GET.get('search', None) try: objects = BillBoard.objects.get(boardId= search_query) except BillBoard.DoesNotExist: return False return BillBoard.objects.get(boardId= search_query) class BillBordFilterView(LoginRequiredMixin, ListView): model = BillBoard template_name = 'user/home.html' # <app>/<model>_<viewtype>.html context_object_name = 'BillBord_list' paginate_by = 3 ordering = ['boardId'] def get_queryset(self): search_query = self.request.GET.get('search', None) try: objects = BillBoard.objects.filter(city= search_query) except BillBoard.DoesNotExist: return False return BillBoard.objects.filter(city= search_query)
[ "aleenav.sayone@gmail.com" ]
aleenav.sayone@gmail.com
9abbe07830ef42f726486d4859b96e0c7f30f1ef
4cfdcb102dc1c8eed379401cc6edd2a6f423f937
/pksig_all other code/pksig_cllww12_benchmark.py
2d49a3269347b6e27536565d6b584b873c6660f8
[]
no_license
zfwise/myCharmCode
daf10467d993cbc1c469271ab53234f2a84b6d3a
15578a942ecd8f3a614714d3c04a7ce55b0fb7ca
refs/heads/master
2021-01-18T18:12:19.482614
2013-04-26T14:08:32
2013-04-26T14:08:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
9,078
py
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair from charm.core.crypto.cryptobase import * from charm.toolbox.IBEnc import IBEnc from charm.schemes.pksig.pksig_cllww12 import Sign_Chen12 from charm.schemes.pksig.pksig_cllww12_swap import Sign_Chen12_swap from charm.schemes.pksig.pksig_cllww12_swap_improved import Sign_Chen12_swap_improved from charm.schemes.pksig.pksig_bls04 import IBSig from charm.schemes.pksig.pksig_waters05 import IBE_N04_Sig from charm.schemes.pksig.pksig_waters05_improved import IBE_N04_Sig_improved from charm.schemes.pksig.pksig_waters09_improved import IBEWaters09_improved from charm.toolbox.hash_module import Waters import time import string import random def randomStringGen(size=10, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) n = 200 #groupObj = PairingGroup('MNT224') groupObj = PairingGroup('/home/zfwise/Downloads/pbc-0.5.12/param/f.param', param_file=True) if(1): m = "plese sign this message!!!!" #cllww = Sign_Chen12(groupObj) cllww = Sign_Chen12(groupObj) cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = cllww.keygen() cllwwKeyGenTime += time.time() - startTime m = randomStringGen() startTime = time.time() signature = cllww.sign(pk, sk, m) cllwwSignTime += time.time() - startTime startTime = time.time() assert cllww.verify(pk, signature, m), "Invalid Verification!!!!" cllwwVerifyTime += time.time() - startTime print("CLLWW12_sign: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("CLLWW12_sign: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("CLLWW12_sign: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) if(1): m = "plese sign this message!!!!" #cllww = Sign_Chen12(groupObj) cllww = Sign_Chen12_swap(groupObj) cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = cllww.keygen() cllwwKeyGenTime += time.time() - startTime m = randomStringGen() startTime = time.time() signature = cllww.sign(pk, sk, m) cllwwSignTime += time.time() - startTime startTime = time.time() assert cllww.verify(pk, signature, m), "Invalid Verification!!!!" cllwwVerifyTime += time.time() - startTime print("CLLWW12_sign_swap: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("CLLWW12_sign_swap: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("CLLWW12_sign_swap: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) if(1): m = "plese sign this message!!!!" #cllww = Sign_Chen12(groupObj) cllww = Sign_Chen12_swap_improved(groupObj) cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = cllww.keygen() cllwwKeyGenTime += time.time() - startTime m = randomStringGen() startTime = time.time() signature = cllww.sign(pk, sk, m) cllwwSignTime += time.time() - startTime startTime = time.time() assert cllww.verify(pk, signature, m), "Invalid Verification!!!!" cllwwVerifyTime += time.time() - startTime print("CLLWW12_sign_swap_improved: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("CLLWW12_sign_swap_improved: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("CLLWW12_sign_swap_improved: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) #groupObj = PairingGroup('MNT224') #groupObj = PairingGroup('SS512') if(1): m = { 'a':"hello world!!!" , 'b':"test message" } bls = IBSig(groupObj) cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = bls.keygen() cllwwKeyGenTime += time.time() - startTime m = {'a':randomStringGen() , 'b':randomStringGen()} startTime = time.time() sig = bls.sign(sk['x'], m) cllwwSignTime += time.time() - startTime startTime = time.time() assert bls.verify(pk, sig, m), "Failure!!!" cllwwVerifyTime += time.time() - startTime print("Bls04: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("Bls04: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("Bls04: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) #groupObj = PairingGroup('MNT159') #groupObj = PairingGroup('SS512') if(1): ibe = IBE_N04_Sig(groupObj) waters = Waters(groupObj) msg = waters.hash("This is a test.") cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = ibe.keygen() cllwwKeyGenTime += time.time() - startTime msg = waters.hash(randomStringGen()) startTime = time.time() sig = ibe.sign(pk, sk, msg) cllwwSignTime += time.time() - startTime startTime = time.time() assert ibe.verify(pk, msg, sig), "Failed verification!" cllwwVerifyTime += time.time() - startTime print("Waters05: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("Waters05: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("Waters05: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) if(1): ibe = IBE_N04_Sig_improved(groupObj) waters = Waters(groupObj) msg = waters.hash("This is a test.") cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (pk, sk) = ibe.keygen() cllwwKeyGenTime += time.time() - startTime msg = waters.hash(randomStringGen()) startTime = time.time() sig = ibe.sign(pk, sk, msg) cllwwSignTime += time.time() - startTime startTime = time.time() assert ibe.verify(pk, msg, sig), "Failed verification!" cllwwVerifyTime += time.time() - startTime print("Waters05_improved: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("Waters05_improved: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("Waters05_improved: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000)) #grp = PairingGroup('MNT224') #grp = PairingGroup('SS512') if(1): ibe = IBEWaters09_improved(groupObj) m = "plese sign this message!!!!" bls = IBSig(groupObj) cllwwKeyGenTime = 0.0 cllwwSignTime = 0.0 cllwwVerifyTime = 0.0 for i in range(0, n): startTime = time.time() (mpk, msk) = ibe.keygen() cllwwKeyGenTime += time.time() - startTime m = randomStringGen() startTime = time.time() sigma = ibe.sign(mpk, msk, m) cllwwSignTime += time.time() - startTime startTime = time.time() assert ibe.verify(mpk, sigma, m), "Invalid Verification!!!!" cllwwVerifyTime += time.time() - startTime print("Waters09: Keygen %d times, average time %f ms" %(n, cllwwKeyGenTime/n*1000)) print("Waters09: Sign random message %d times, average time %f ms" %(n, cllwwSignTime/n*1000)) print("Waters09: Verify %d times, average time %f ms" %(n, cllwwVerifyTime/n*1000)) print("&%.2f () &%.2f () &%.2f ()" %(cllwwKeyGenTime/n*1000, cllwwSignTime/n*1000, cllwwVerifyTime/n*1000))
[ "zfwise@gwu.edu" ]
zfwise@gwu.edu
67d0ed6cd877795ed91f5aacc2466ff064532e60
6b019cc6b08042a6bc915b39353217feabc45910
/converter/biostudies.py
bd61f42e533aa97a8716ffa963eb74ec9ff5121a
[ "Apache-2.0" ]
permissive
ebi-ait/ingest-archiver
c13fa70c42c3649902eec1477b647af783c9b9df
6d48111d9c050200869958991fcc6d10cd93b609
refs/heads/dev
2023-08-03T10:32:25.537418
2023-07-29T19:40:24
2023-07-29T19:40:24
234,517,272
2
4
Apache-2.0
2022-08-16T14:12:18
2020-01-17T09:36:55
Python
UTF-8
Python
false
false
8,590
py
import copy from datetime import datetime from json_converter.json_mapper import JsonMapper from json_converter.post_process import default_to from converter import array_to_string ACCNO_PREFIX_FOR_ORGANIZATIONS = "o" ACCNO_PREFIX_FOR_AUTHORS = "a" PUBLICATION_SPEC = { 'type': 'Publication', 'on': 'publications', 'attributes_to_include': { 'authors': "Authors", 'title': "Title", 'doi': 'doi', 'url': 'URL' }, 'attribute_handler': { 'authors': array_to_string } } AUTHORS_SPEC = { 'type': 'Author', 'on': 'contributors', 'attributes_to_include': { 'name': 'Name', 'first_name': 'First Name', 'middle_initials': 'Middle Initials', 'last_name': 'Last Name', 'email': 'Email', 'phone': 'Phone', 'address': 'Address', 'orcid_id': 'Orcid ID' } } FUNDING_SPEC = { 'type': 'Funding', 'on': 'funders', 'attributes_to_include': { 'grant_id': 'grant_id', 'grant_title': 'Grant Title', 'organization': 'Agency' } } class BioStudiesConverter: def __init__(self): self.attributes = None self.contributors = None self.funders = None self.publications = None self.project_spec_base = [ { 'name': ['', default_to, 'Project Core - Project Short Name'], 'value': ['content.project_core.project_short_name'] }, { 'name': ['', default_to, 'HCA Project UUID'], 'value': ['uuid.uuid'] } ] self.project_spec_section = { 'accno': ['', default_to, 'PROJECT'], 'type': ['', default_to, 'Study'], 'attributes': ['$array', [ { 'name': ['', default_to, 'Title'], 'value': ['content.project_core.project_title'] }, { 'name': ['', default_to, 'Description'], 'value': ['content.project_core.project_description'] } ], True ] } def convert(self, hca_project: dict, additional_attributes: dict = None) -> dict: converted_project = JsonMapper(hca_project).map({ 'attributes': ['$array', self.project_spec_base, True], 'section': self.project_spec_section }) self.add_release_date(converted_project, hca_project) project_content = hca_project['content'] if 'content' in hca_project else None if project_content: self.__add_subsections_to_project(converted_project, project_content) return converted_project @staticmethod def add_release_date(converted_project, hca_project): release_date = hca_project.get('releaseDate') if release_date: converted_project.get('attributes').append( { 'name': 'ReleaseDate', 'value': release_date } ) def __add_subsections_to_project(self, converted_project, project_content): contributors = project_content.get('contributors') funders = project_content.get('funders') publications = project_content.get('publications') if contributors or funders or publications: converted_project['section']['subsections'] = [] converted_publications = self.add_attributes_by_spec(PUBLICATION_SPEC, project_content) converted_organizations = [] project_content_with_structured_names = self.transform_author_names(project_content) converted_authors = self.add_attributes_by_spec(AUTHORS_SPEC, project_content_with_structured_names) if contributors else [] BioStudiesConverter.__add_accno(converted_authors, ACCNO_PREFIX_FOR_AUTHORS) BioStudiesConverter.__add_affiliation(contributors, converted_authors, converted_organizations) converted_funders = self.add_attributes_by_spec(FUNDING_SPEC, project_content) if funders else [] converted_project['section']['subsections'] = \ converted_publications + converted_authors + converted_organizations + converted_funders @staticmethod def __add_accno(converted_authors, prefix): for index, author in enumerate(converted_authors, start=1): author['accno'] = prefix + str(index) @staticmethod def __add_affiliation(contributors: list, converted_authors: list, converted_organizations: list): index = 1 for contributor in contributors: affiliation = {} if 'institution' in contributor: author: dict = BioStudiesConverter.__get_author_by_name(contributor.get('name'), converted_authors) affiliation['name'] = 'affiliation' affiliation['reference'] = True affiliation['value'] = 'o' + str(index) author.get('attributes').append(affiliation) converted_organizations.append( BioStudiesConverter.__add_new_organization(contributor.get('institution'), index)) index += 1 @staticmethod def __get_author_by_name(contributor_name: str, authors: list): for author in authors: for attribute in author.get('attributes'): if attribute.get('name') == 'Name' and attribute.get('value') == contributor_name: return author return None @staticmethod def __add_new_organization(organization_name: str, index: int): return \ { 'accno': ACCNO_PREFIX_FOR_ORGANIZATIONS + str(index), 'type': 'Organization', 'attributes': [ { 'name': 'Name', 'value': organization_name } ] } @staticmethod def transform_author_names(project_content: dict) -> dict: project_content_with_structured_name = copy.deepcopy(project_content) contributors = project_content_with_structured_name.get('contributors') contributor: dict for contributor in contributors: full_name = contributor.get('name') structured_name = BioStudiesConverter.convert_full_name(full_name) contributor.update(structured_name) return project_content_with_structured_name @staticmethod def add_attributes_by_spec(specification: dict, project_content: dict): subsection_type_list = [] iterate_on = specification.get('on') attributes_to_include: dict = specification.get('attributes_to_include') for entity in project_content.get(iterate_on, []): subsection_payload_element = {} attribute_list = [] for attribute_key in attributes_to_include: if entity.get(attribute_key): attribute_handler = specification.get('attribute_handler', {}).get(attribute_key) value = entity.get(attribute_key) if attribute_handler: value = attribute_handler(value) attribute_list.append( { 'name': attributes_to_include.get(attribute_key), 'value': value } ) if len(attribute_list) > 0: subsection_payload_element.update( { 'type': specification.get('type'), 'attributes': attribute_list } ) subsection_type_list.append(subsection_payload_element) return subsection_type_list @staticmethod def convert_full_name(full_name: str) -> dict: if full_name is None: return {} name_parts = full_name.split(',', 2) first_name = name_parts[0] if len(name_parts) <= 2: middle_initials = None last_name = name_parts[1] else: middle_initials = name_parts[1][0] if name_parts[1] else None last_name = name_parts[2] structured_name = { 'first_name': first_name, 'last_name': last_name } if middle_initials: structured_name['middle_initials'] = middle_initials return structured_name
[ "karoly@ebi.ac.uk" ]
karoly@ebi.ac.uk
af9e7b5aa228de28434df110fd779d32173f3e3f
ddaee32e64c1320245a0422a681e70ffeafe5c14
/unit_tests.py
8a2cfd895fc9b7dfbb302aa1e0979fc4aacfeb09
[]
no_license
LiDuaDua/DecisionTree-with-REP-pruning
4270c66df5355cf88cc384d23826d67aaca4dc23
8c80f33a00f1ce8bc92594b6ed6a70605948697e
refs/heads/master
2021-01-19T16:02:46.494620
2017-04-14T07:23:23
2017-04-14T07:23:23
88,242,224
0
0
null
null
null
null
UTF-8
Python
false
false
5,285
py
import ID3, parse, random import matplotlib.pyplot as plt import numpy as np def testID3AndEvaluate(): data = [dict(a=1, b=0, Class=1), dict(a=1, b=1, Class=1)] tree = ID3.ID3(data, 0) if tree != None: ans = ID3.evaluate(tree, dict(a=1, b=0)) if ans != 1: print "ID3 test failed." else: print "ID3 test succeeded." else: print "ID3 test failed -- no tree returned" def testPruning(): data = [dict(a=1, b=0, Class=1), dict(a=1, b=1, Class=1), dict(a=0, b=1, Class=0), dict(a=0, b=0, Class=1)] validationData = [dict(a=1, b=0, Class=1), dict(a=1, b=1, Class=1), dict(a=0, b=0, Class=0), dict(a=0, b=0, Class=0)] tree = ID3.ID3(data, 0) ID3.prune(tree, validationData) if tree != None: ans = ID3.evaluate(tree, dict(a=0, b=0)) if ans != 0: print "pruning test failed." else: print "pruning test succeeded." else: print "pruning test failed -- no tree returned." def testID3AndTest(): trainData = [dict(a=1, b=0, c=0, Class=1), dict(a=1, b=1, c=0, Class=1), dict(a=0, b=0, c=0, Class=0), dict(a=0, b=1, c=0, Class=1)] testData = [dict(a=1, b=0, c=1, Class=1), dict(a=1, b=1, c=1, Class=1), dict(a=0, b=0, c=1, Class=0), dict(a=0, b=1, c=1, Class=0)] tree = ID3.ID3(trainData, 0) fails = 0 if tree != None: acc = ID3.test(tree, trainData) if acc == 1.0: print "testing on train data succeeded." else: print "testing on train data failed." fails = fails + 1 acc = ID3.test(tree, testData) if acc == 0.75: print "testing on test data succeeded." else: print "testing on test data failed." fails = fails + 1 if fails > 0: print "Failures: ", fails else: print "testID3AndTest succeeded." else: print "testID3andTest failed -- no tree returned." # inFile - string location of the house data file def testPruningOnHouseData(inFile): withPruning = [] withoutPruning = [] data = parse.parse(inFile) for i in range(100): random.shuffle(data) train = data[:len(data)/2] valid = data[len(data)/2:3*len(data)/4] test = data[3*len(data)/4:] tree = ID3.ID3(train, 'democrat') acc = ID3.test(tree, train) print "training accuracy: ",acc acc = ID3.test(tree, valid) print "validation accuracy: ",acc acc = ID3.test(tree, test) print "test accuracy: ",acc ID3.prune(tree, valid) acc = ID3.test(tree, train) print "pruned tree train accuracy: ",acc acc = ID3.test(tree, valid) print "pruned tree validation accuracy: ",acc acc = ID3.test(tree, test) print "pruned tree test accuracy: ",acc withPruning.append(acc) tree = ID3.ID3(train+valid, 'democrat') acc = ID3.test(tree, test) print "no pruning test accuracy: ",acc withoutPruning.append(acc) print withPruning print withoutPruning print "average with pruning",sum(withPruning)/len(withPruning)," without: ",sum(withoutPruning)/len(withoutPruning) def accuPlot(Dic, title): plt.figure() plt.title('learning curve' + title + 'pruning') plt.xlabel('Batch Size') plt.ylabel('Accuracy') plt.grid(True) xList = [] yList = [] for keys in Dic: xList.append(keys) xList.sort() for item in xList: yList.append(Dic[item]) plt.plot(np.array(xList), np.array(yList)) plt.show() def randomPlot(inFile): withPruning = {} withoutPruning = {} withoutPruningTrain = [] withoutPruningValid = [] withoutPruningTest = [] withPruningTrain = [] withPruningValid = [] withPruningTest = [] data = parse.parse(inFile) for i in range(100): random.shuffle(data) batchSize = random.randint(10, 300) while batchSize in withoutPruning: batchSize = random.randint(10, 300) train = data[: int(batchSize * 0.7)] valid = data[int(batchSize * 0.7):batchSize] test = data[batchSize:] tree = ID3.ID3(train, 'democrat') ''' acc = ID3.test(tree, train) #withoutPruningTrain.append(acc) acc = ID3.test(tree, valid) #withoutPruningValid.append(acc) tree = ID3.ID3(train + valid, 'democrat') acc = ID3.test(tree, test) #withoutPruningTest.append(acc) ''' ID3.prune(tree, valid) # acc = ID3.test(tree, train) # withPruningTrain.append(acc) # acc = ID3.test(tree, valid) # withPruningValid.append(acc) acc = ID3.test(tree, test) withPruning[batchSize] = acc tree = ID3.ID3(train + valid, 'democrat') acc = ID3.test(tree, test) withoutPruning[batchSize] = acc accuPlot(withoutPruning, 'without') accuPlot(withPruning, 'with') print len(withoutPruning), len(withPruning) testID3AndEvaluate() #root = ID3(preprocess("house_votes_84.data"), 0) #print "root label", root.label #print "\n\n\n\nBFS =++++++++++++++++++++++++++++\n", str(node.breadth_first_search(root)) testID3AndTest() testPruning() testPruningOnHouseData("house_votes_84.data") randomPlot("house_votes_84.data")
[ "bestlzl1994@gmail.com" ]
bestlzl1994@gmail.com
aa8496b9327623dffb3ff03cf1fc191646340675
bf9be62b49e1096e8983753e9a8606f9d4fdb987
/beisia_app/memo/migrations/0003_lists_phone.py
741b12afeda8026dab5ad46c8f656443ef9c00ba
[]
no_license
sakuraichigo/baisia
6dbef747e8c77514e8e10985f5741c67a33412be
4a77185420d761c64d3a336217d3d1c27b3c014a
refs/heads/master
2023-01-30T19:36:17.810994
2020-12-11T07:10:03
2020-12-11T07:10:03
320,491,200
0
0
null
null
null
null
UTF-8
Python
false
false
370
py
# Generated by Django 3.0.5 on 2020-11-20 06:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('memo', '0002_lists_date'), ] operations = [ migrations.AddField( model_name='lists', name='phone', field=models.IntegerField(null=True), ), ]
[ "sakura15yumy@gmail.com" ]
sakura15yumy@gmail.com
0cbe171c509209bed85a34988e5940acc8efcb70
e9c3c631eac669b211ff6ae99587916aba5ec71b
/Part5FeatureObtainer.py
65ce9dcb9ba7afff8dca092cfcf74f3f09e92ded
[]
no_license
Shaun2h/Basic-HMM
9d59759ba3ad1add3a5bd4c9682101d21420bb1d
336b0ceae047d76c53ef147dec15863e63c4e2ed
refs/heads/master
2020-04-06T21:47:53.452959
2019-01-24T08:37:28
2019-01-24T08:37:28
157,814,310
1
0
null
null
null
null
UTF-8
Python
false
false
10,318
py
def line_feature(line,force_lowercase): # Returns the actual word, classification, and whether it is a punctuation """Place your lines here to process""" holder = line.split() classification = holder.pop() string = "" # get completed word for i in holder: string += i if force_lowercase: string = string.lower() if string.isalnum(): # is alphanumeric. return string, classification, # False else: # holds a punctuation. In all likelihood it shouldn't be a name anyway. return string, classification # True # Uncomment for punctuation handling. Not used in beta submission. def converter(some_dict_of_dicts): """convert from raw counts to probabilities, based off containment in dictionary""" for outerkey in some_dict_of_dicts.keys(): summer = 0 for innerkey in some_dict_of_dicts[outerkey]: summer += some_dict_of_dicts[outerkey][innerkey] for innerkey in some_dict_of_dicts[outerkey]: some_dict_of_dicts[outerkey][innerkey] = some_dict_of_dicts[outerkey][innerkey] / summer return some_dict_of_dicts def file_parser(fileaddr, force_lowercase): """Grab your file addr and parse file for sentence""" f = open(fileaddr, "r", encoding="UTF-8") big_list = [] latest = [] for line in f: if line != "\n": # is not empty line. latest.append(line_feature(line, force_lowercase)) # obtain feature + tag else: big_list.append(latest) latest = [] # for i in big_list: # print(i) f.close() return big_list def context_window_one_mle_tag_separation(sentences_list): # gets for Word_Occurrences_in_tag/Total in tag. # does not attempt to capture transition as it can be obtained from that of the other files # instead, obtains the forward/backward words and the TAG. # self word emission is not included # this is the version that was originally included in the instructions. # results in internal bias. # If the word appears 400 times, 399 times in a 10,000 O-tag, vs 1 time in the 2 times # I-negative tag, I negative emission is ruled as more likely. # but on the other hand, you can always smooth for tags it doesn't appear as. # some form of smoothing is required for unknown words. # in this case, we will most likely use additive smoothing, or 1 + smoothing, just like the # original instructions given. forward_word = {} backward_word = {} start_tag_key = "_START_" end_tag_key = "_STOP_" for sentence in sentences_list: for index in range(len(sentence)): # number of observations/tag in sentence current_tag = sentence[index][1] # obtain current tag ###################################################################################### # BACKWARD EMISSION if index != 0: # i.e not at the start of the sentence word_before = sentence[index-1][0] else: # next is at the end tag. i.e _END_TAG_ word_before = start_tag_key if current_tag not in backward_word.keys(): # check if tag exists in back dict backward_word[current_tag] = {} try: # attempt to increment word, in its current tag backward_word[current_tag][word_before] = \ backward_word[current_tag][word_before] + 1 except KeyError: backward_word[current_tag][word_before] = 1 ###################################################################################### # FORWARD EMISSION if index + 1 < len(sentence): # next is currently still in range of sentence's last word next_word = sentence[index + 1][0] else: next_word = end_tag_key # next is stop. if current_tag not in forward_word.keys(): # check if tag exists in back dict forward_word[current_tag] = {} try: # attempt to increment word, in its current tag forward_word[current_tag][next_word] = \ forward_word[current_tag][next_word] + 1 except KeyError: forward_word[current_tag][next_word] = 1 # print(forward_word) # print(backward_word) return forward_word, backward_word def context_window_one_mle_own_word_distinction(sentences_list): # Record all occurrences of words that occur before and after a central tag. # i.e # O B O # Hello you twat # then it records as Forward:{ B: {"Hello":1} } and Backward{ B: {"twat": 1} } # Because of the way it is recorded, you get dictionaries with the TAG as it's header, and # the number of occurrences of that word. # The bias here is in some words always only leading up to one other particular tag in your set, # which might not apply globally. # This version like the previous, will lead to bias, # as words that only appear as a particular foreword to a tag, # will always result in the final result having that particular TAG. # i.e if Hello only appears in B in the forward dictionary, but not in any other dictionary # located inside forward, B will be the most likely TAG from that. # Some form of smoothing is required. forward_word = {} backward_word = {} start_tag_key = "_START_" end_tag_key = "_STOP_" list_of_tags = [] for sentence in sentences_list: for index in range(len(sentence)): # number of observations/tag in sentence current_tag = sentence[index][1] # obtain current tag if current_tag not in list_of_tags: list_of_tags.append(current_tag) ###################################################################################### # BACKWARD EMISSION if index != 0: # i.e not at the start of the sentence word_before = sentence[index-1][0] else: # It's the starting of a sentence. word_before = start_tag_key # this acts as an indicator to tell us to disregard. if word_before not in backward_word.keys() and word_before != start_tag_key: # check if tag exists in back dict and is not START backward_word[word_before] = {} if word_before != start_tag_key: # ensure we disregard start tag try: # attempt to increment word, in its current tag backward_word[word_before][current_tag] = \ backward_word[word_before][current_tag] + 1 except KeyError: backward_word[word_before][current_tag] = 1 ###################################################################################### # FORWARD EMISSION if index + 1 < len(sentence): # next is currently still in range of sentence's last word next_word = sentence[index + 1][0] else: next_word = end_tag_key # next is stop. if next_word not in forward_word.keys() and next_word != end_tag_key: # check if tag exists in back dict and is not STOP forward_word[next_word] = {} if next_word != end_tag_key: # ensure we aren't trying to count a stop tag. try: # attempt to increment word, in its current tag forward_word[next_word][current_tag] = \ forward_word[next_word][current_tag] + 1 except KeyError: forward_word[next_word][current_tag] = 1 # training is more or less complete. # print(forward_word) # print(backward_word) return forward_word, backward_word, list_of_tags def add_unk_TAG_TOTAL1(provided_dict,list_of_tags): # the version of a unk for the dictionary in the format of # context_window_one_mle_own_word_distinction # unk is estimated in the same way as the provided rule. count = {} for tag in list_of_tags: count[tag] = 0 for word in provided_dict: for tag in provided_dict[word]: count[tag] = count[tag] + provided_dict[word][tag] summer = 0 for tag in list_of_tags: summer += count[tag] for tag in list_of_tags: count[tag] = count[tag]/summer provided_dict["#UNK#"] = count return provided_dict def add_one_smoother_converter(either_word, tag_list): """add one smoothing is performed for every word. does not apply to unknowns.""" # this method is debatably fairer ish for words. # you lose the information of how often that tag has appeared, and to an extent, whether the # word should ever be in that tag, instead choosing to focus on allowing all words to be # anything. Works best for words like "fucking", which can be used in literally any tag. # in that case however for outerkey in either_word.keys(): summer = 0 for innerkey in either_word[outerkey]: summer += either_word[outerkey][innerkey] temp_list = [] # to hold tags that did not appear for innerkey in tag_list: if innerkey in either_word[outerkey].keys(): either_word[outerkey][innerkey] = either_word[outerkey][innerkey] / summer else: temp_list.append(innerkey) summer += 1 # incrememnt the summer for add one smoothing use holdvalue = 1/summer # compute a add one smoothing tag probability for tag in temp_list: either_word[outerkey][tag] = holdvalue return either_word # testing stuff # # sentence_get = file_parser("EN/train", True) # print("OWN WORD DISTINCTION") # forward_dist, backward_dist, list_o_tags = context_window_one_mle_own_word_distinction(sentence_get) # print(converter(forward_dist)) # print(converter(backward_dist)) # print(add_one_smoother_converter(forward_dist, list_o_tags)) # print(add_one_smoother_converter(backward_dist, list_o_tags)) """ print("TAG SEPARATION") forwardtag, backwardtag = context_window_one_mle_tag_separation(sentence_get) print(converter(forwardtag)) print(converter(backwardtag)) """
[ "smurfination1@gmail.com" ]
smurfination1@gmail.com
477db84e7b886bf239362f2011c9005cc081462c
0a973640f0b02d7f3cf9211fcce33221c3a50c88
/.history/src/qichamao_cmpInfo_20210129160650.py
41a75bbec713f276826d997f9fcd49cf5f4aab93
[]
no_license
JiajunChen123/IPO_under_review_crawler
5468b9079950fdd11c5e3ce45af2c75ccb30323c
031aac915ebe350ec816c05a29b5827fde588567
refs/heads/main
2023-02-26T08:23:09.622725
2021-02-04T10:11:16
2021-02-04T10:11:16
332,619,348
0
0
null
null
null
null
UTF-8
Python
false
false
2,386
py
import requests from bs4 import BeautifulSoup import time # login = {'user':'13710149700', # 'password':'123456'} # 使用的网站是企查查 # requests.post('https://www.qichamao.com',data=login,headers=afterLogin_headers) afterLogin_headers = {'Cookie':'qznewsite.uid=y4eseo3a1q4xbrwimor3o5tm; Hm_lvt_55ad112b0079dd9ab00429af7113d5e3=1611805092; qz.newsite=6C61702DD95709F9EE190BD7CCB7B62C97136BAC307B6F0B818EC0A943307DAB61627F0AC6CD818268C10D121B37F840C1EF255513480EC3012A7707443FE523DD7FF79A7F3058E5E7FB5CF3FE3544235D5313C4816B54C0CDB254F24D8ED5235B722BCBB23BE62B19A2370E7F0951CD92A731FE66C208D1BE78AA64758629806772055F7210C67D442DE7ABBE138EF387E6258291F8FBF85DFF6C785E362E2903705A0963369284E8652A61531293304D67EBB8D28775FBC7D7EBF16AC3CCA96F5A5D17; Hm_lpvt_55ad112b0079dd9ab00429af7113d5e3=1611892605', 'Referer':'https://www.qichamao.com/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'} def get_compInfo(comp): r = requests.get('https://www.qichamao.com/search/all/{}'.format(comp),headers=afterLogin_headers) r.raise_for_status() r.encoding = 'utf-8' #linux utf-8 soup = BeautifulSoup(r.text,features="html.parser") url = 'http://www.qichamao.com' + soup.find(attrs={'class':'listsec_con'}).a['href'] # soup.find(attrs={'class':'listsec_con'}) time.sleep(5) rs = requests.get(url,headers=afterLogin_headers) rs.encoding='utf-8' soup2 = BeautifulSoup(rs.text,'html.parser') info = soup2.find(attrs={'class':'qd-table-body li-half f14'}).findAll('div') info = [i.get_text().strip() for i in info] compinfo = {'法定代表人':info[0], '纳税人识别号':info[1], '名称':info[2], '机构代码':info[3], '注册号':info[4], '注册资本':info[5], '统一社会信用代码':info[6], '登记机关':info[7], '经营状态':info[8], '成立日期':info[9], '企业类型':info[10], '经营期限':info[11], '所属地区':info[12], '核准时间':info[13], '企业地址':info[14], '经营范围':info[15]} return compinfo if __name__ == '__main__': compList =
[ "chenjiajun.jason@outlook.com" ]
chenjiajun.jason@outlook.com
2fefc1e52ae0e6cfbbfc6ff6ca2d377a99c5d549
39896b6ca41d589e2eccb3dcb0c716340a444afe
/tensorflow/2.定义变量variable.py
6536225d9b0260abfb7dd04de5d6a3ff5a8fcf00
[]
no_license
coco369/algorithm
237bf5f7691a70bd98c90be5c604a16155448e86
a069ae7ee6f4cb421ba3e44d13371716e75314b6
refs/heads/master
2022-12-29T10:48:11.282338
2020-10-13T10:25:46
2020-10-13T10:25:46
263,520,123
1
1
null
null
null
null
UTF-8
Python
false
false
242
py
import tensorflow as tf """ 定义变量 """ a = tf.Variable(1) print('value:', a.numpy()) b = a + 1 print('value:', b.numpy()) c = tf.Variable(4) c.assign_add(2) print('value:', c.numpy()) c.assign_sub(1) print('value:', c.numpy())
[ "1571236356@qq.com" ]
1571236356@qq.com
b5ad7749f829100b0ef3b43a66a64a5e805ac245
469a4e535877e868c590ddfdeae7451b9ad3b5bf
/case3_form_filling/pybrain_rlklm/egreedy.py
5158f189554052db45ebae2419cd98ed40d36147
[ "BSD-2-Clause" ]
permissive
aalto-speech/rl-klm
443c3c182e30d4fde75d44b80f13db929a99d9d9
1a48fc49c1afae581720dc2eab4055816b887cb2
refs/heads/master
2021-07-19T05:08:14.276118
2020-05-18T10:57:32
2020-05-18T10:57:32
163,522,009
3
0
null
null
null
null
UTF-8
Python
false
false
1,564
py
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de" # MODIFIED by Katri Leino: Only select allowed actions in exploration. from scipy import random, array import numpy as np from pybrain.rl.explorers.discrete.discrete import DiscreteExplorer from pybrain.rl.environments.environment import Environment class EpsilonGreedyExplorer(DiscreteExplorer): """ A discrete explorer, that executes the original policy in most cases, but sometimes returns a random action (uniformly drawn) instead. The randomness is controlled by a parameter 0 <= epsilon <= 1. The closer epsilon gets to 0, the more greedy (and less explorative) the agent behaves. """ def __init__(self, epsilon = 0.3, decay = 0.9999): DiscreteExplorer.__init__(self) self.epsilon = epsilon self.decay = decay self.env = [] def _forwardImplementation(self, inbuf, outbuf): """ Draws a random number between 0 and 1. If the number is less than epsilon, a random action is chosen. If it is equal or larger than epsilon, the greedy action is returned. """ assert self.module # Choose action from allowed actions. if random.random() < self.epsilon: # Only select allowed actions allowed_actions = np.where(np.array(self.env.visited_states) == 0)[0] act = array([random.choice(allowed_actions)]) outbuf[:] = act else: outbuf[:] = inbuf self.epsilon *= self.decay
[ "katri.k.leino@aalto.fi" ]
katri.k.leino@aalto.fi
af50ff57d4d23ba855a7064fe2d3e77f667e3432
fa57716e950b1ad1970f158ac2346c9c918267a6
/opengever/latex/tests/test_dossierlisting.py
4847964ef8ff53fa86cb77fe71382dedf7f74b2a
[]
no_license
hellfish2/opengever.core
1e76e04439f89518bb3f7bb021f83ae4fa4ff7fc
954964872f73c0d18d5b0e0ab2dbf603849e4e87
refs/heads/master
2020-04-08T18:03:06.781579
2014-06-05T13:02:05
2014-06-05T13:02:05
20,575,363
1
0
null
null
null
null
UTF-8
Python
false
false
2,328
py
from ftw.pdfgenerator.interfaces import IBuilder from ftw.pdfgenerator.interfaces import ILaTeXLayout from ftw.pdfgenerator.interfaces import ILaTeXView from ftw.testing import MockTestCase from grokcore.component.testing import grok from opengever.latex import dossierlisting from opengever.latex.testing import LATEX_ZCML_LAYER from zope.component import adaptedBy from zope.component import getMultiAdapter from zope.interface.verify import verifyClass from zope.publisher.interfaces.browser import IDefaultBrowserLayer class TestDossierListingPDFView(MockTestCase): layer = LATEX_ZCML_LAYER def test_is_registered(self): context = self.create_dummy() request = self.providing_stub([IDefaultBrowserLayer]) self.replay() view = getMultiAdapter((context, request), name='pdf-dossier-listing') self.assertTrue(isinstance( view, dossierlisting.DossierListingPDFView)) def test_render_adds_browser_layer(self): context = request = self.create_dummy() view = self.mocker.patch( dossierlisting.DossierListingPDFView(context, request)) self.expect(view.allow_alternate_output()).result(False) self.expect(view.export()) self.replay() view.render() self.assertTrue(dossierlisting.IDossierListingLayer.providedBy( request)) class TestDossierListingLaTeXView(MockTestCase): layer = LATEX_ZCML_LAYER def test_component_is_registered(self): context = self.create_dummy() request = self.providing_stub([dossierlisting.IDossierListingLayer]) layout = self.providing_stub([ILaTeXLayout]) self.replay() view = getMultiAdapter((context, request, layout), ILaTeXView) self.assertEqual(type(view), dossierlisting.DossierListingLaTeXView) def test_implements_interface(self): self.assertTrue(ILaTeXView.implementedBy( dossierlisting.DossierListingLaTeXView)) verifyClass(ILaTeXView, dossierlisting.DossierListingLaTeXView) def test_adapts_layer(self): context_iface, request_iface, layout_iface = adaptedBy( dossierlisting.DossierListingLaTeXView) self.assertEqual(request_iface, dossierlisting.IDossierListingLayer)
[ "jone@jone.ch" ]
jone@jone.ch
3394c6a751749a717887e0e98f938a281d9e151c
46e7c10f91329d05b9200ab0e53950abc8ab6d8b
/app/user/tests/test_user_api.py
2f0938d6300b9c0455c68a9de044229e3f302c5a
[ "MIT" ]
permissive
Romitha/recipe-api-django-rest
4306f4c55a044768f5f4e56ad1a8a357c04a0eaf
d1b64ab2fe384eee8cff124168273ac7316bf72e
refs/heads/master
2020-12-09T14:40:01.993169
2020-01-28T06:07:08
2020-01-28T06:07:08
233,336,519
0
0
null
null
null
null
UTF-8
Python
false
false
4,834
py
from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework.test import APIClient from rest_framework import status CREATE_USER_URL = reverse('user:create') TOKEN_URL = reverse('user:token') ME_URL = reverse('user:me') def create_user(**params): return get_user_model().objects.create_user(**params) class PublicUserApiTests(TestCase): """ Test the user api public""" def setUp(self): self.client = APIClient() def test_create_valid_user_success(self): """ Test creating user with valid payload is successful""" payload = { 'email': 'test@gmail.com', 'password': 'test123', 'name': 'Test Name' } res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_201_CREATED) user = get_user_model().objects.get(**res.data) self.assertTrue(user.check_password(payload['password'])) self.assertNotIn('password', res.data) def test_user_exists(self): """Test creating user that already exists fail""" payload = {'email': 'test@gmail.com', 'password': 'test123'} create_user(**payload) res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_password_too_short(self): """Test that the password must be more than 5 characters""" payload = {'email': 'test@gmail.com', 'password': 'pw'} res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) user_exists = get_user_model().objects.filter( email=payload['email'] ).exists() self.assertFalse(user_exists) def test_create_token_for_user(self): """Test that a token is created for the user""" payload = {'email': 'test@gmail.com', 'password': 'test123'} create_user(**payload) res = self.client.post(TOKEN_URL, payload) print(res) self.assertIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_200_OK) def test_create_token_invalid_credentials(self): """Test that token is not created if invalid credentials are given""" create_user(email='test@londonappdev.com', password='testpass') payload = {'email': 'test@londonappdev.com', 'password': 'wrong'} res = self.client.post(TOKEN_URL, payload) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_create_token_no_user(self): """Test that token is not created if user doens't exist""" payload = {'email': 'test@londonappdev.com', 'password': 'testpass'} res = self.client.post(TOKEN_URL, payload) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_create_token_missing_field(self): """Test that email and password are required""" res = self.client.post(TOKEN_URL, {'email': 'one', 'password': ''}) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_retrieve_user_unauthorized(self): """Test that authentication is required for users""" res = self.client.get(ME_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED) class PrivateUserApiTests(TestCase): """Test API requests that require authentication""" def setUp(self): self.user = create_user( email='test@mail.com', password='testpass', name='name' ) self.client = APIClient() self.client.force_authenticate(user=self.user) def test_retrieve_profile_success(self): """Test retrieving profile for logged user""" res = self.client.get(ME_URL) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(res.data, { 'name': self.user.name, 'email': self.user.email }) def test_post_me_not_allowed(self): """Test that post is not allow on the url""" res = self.client.post(ME_URL, {}) self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) def test_update_user_profile(self): """Test update user profile for authenticate user""" payload = {'name': 'new name', 'password': "newpassword123"} res = self.client.patch(ME_URL, payload) self.user.refresh_from_db() self.assertEqual(self.user.name, payload['name']) self.assertTrue(self.user.check_password(payload['password'])) self.assertEqual(res.status_code, status.HTTP_200_OK)
[ "janith2011@gmail.com" ]
janith2011@gmail.com
99b09c524ea449b6bbe9bf5eaacbfb72619c2baa
f4be48866d7d2181d563939cee82671b893ddbb9
/kubecd/cli/__init__.py
cd5b30c9e7f93b6d691f26ac10bb7aeef69f7ed4
[ "Apache-2.0" ]
permissive
cvega/kubecd
cd893639cf6e683caa6a94eea730cf956be3f0ed
3e181d29caa4220c19dcd80ed44e5aaec1e6c955
refs/heads/master
2020-03-26T22:19:51.775077
2018-06-20T06:12:23
2018-06-20T06:12:23
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,260
py
import argparse import os import sys import argcomplete import logging from argcomplete import FilesCompleter from blessings import Terminal from .. import __version__ from .commands import ( apply_env, dump_env, indent_file, init_contexts, json2yaml, lint_environment, list_kind, observe_new_image, poll_registries, use_env_context, CliError, ) t = Terminal() logger = logging.getLogger(__name__) def parser(prog='kcd') -> argparse.ArgumentParser: p = argparse.ArgumentParser(prog=prog) # not used yet, but left here as a reminder to not steal the -c flag # p.add_argument('-c', '--config-file', help='path to configuration file') p.add_argument( '-f', '--environments-file', help='KubeCD config file file (default $KUBECD_ENVIRONMENTS or "environments.yaml")', metavar='FILE', default=os.getenv('KUBECD_ENVIRONMENTS', 'environments.yaml')).completer = FilesCompleter( allowednames=('.yaml', '.yml'), directories=False) p.add_argument( '--version', help='Show version and exit.', action='version', version='kubecd ' + __version__) p.add_argument('--verbose', '-v', help='Increase verbosity level', action='count', default=0) s = p.add_subparsers(dest='command', title='Subcommands', description='Use one of these sub-commands:') apply = s.add_parser('apply', help='apply changes to Kubernetes') apply.add_argument('--dry-run', '-n', action='store_true', default=False, help='dry run mode, only print commands') apply.add_argument('--debug', action='store_true', default=False, help='run helm with --debug') apply.add_argument('--releases', '-r', action='append', help='apply only these releases') apply.add_argument('--cluster', '-c', nargs='?', metavar='CLUSTER', help='apply all environments in CLUSTER') apply.add_argument('--init', action='store_true', default=False, help='Initialize credentials and contexts') apply.add_argument('env_name', nargs='?', metavar='ENV', help='name of environment to apply, must be specified unless --cluster is') apply.set_defaults(func=apply_env) # diff = s.add_parser('diff', help='show diffs between running and git release') # diff.add_argument('--releases', '-r', help='which releases to diff', action='append') # diff.add_argument('env', nargs='?', help='name of environment') # diff.set_defaults(func=diff_release) poll_p = s.add_parser('poll', help='poll for new images in registries') poll_p.add_argument('--patch', '-p', action='store_true', help='patch releases.yaml files with updated version') poll_p.add_argument('--releases', '-r', action='append', help='poll this specific release') poll_p.add_argument('--image', '-i', help='poll releases using this image') poll_p.add_argument('--cluster', '-c', help='poll all releases in this cluster') poll_p.add_argument('env', nargs='?', help='name of environment to poll') poll_p.set_defaults(func=poll_registries) dump_p = s.add_parser('dump', help='dump commands for one or all environments') dump_p.add_argument('env', nargs='?', help='name of environment to dump') dump_p.set_defaults(func=dump_env) list_p = s.add_parser('list', help='list clusters, environments or releases') list_p.add_argument('kind', choices=['env', 'release', 'cluster'], help='what to list') list_p.set_defaults(func=list_kind) indent_p = s.add_parser('indent', help='canonically indent YAML files') indent_p.add_argument('files', nargs='+', help='file[s] to indent') indent_p.set_defaults(func=indent_file) observe = s.add_parser('observe', help='observe a new image version') observe.add_argument('--image', '-i', metavar='IMAGE:TAG', help='the image, including tag') observe.add_argument('--patch', action='store_true', default=False, help='patch release files with updated tags') observe.add_argument('--submit-pr', action='store_true', default=False, help='submit a pull request with the updated tags') observe.set_defaults(func=observe_new_image) completion_p = s.add_parser('completion', help='print shell completion script') completion_p.set_defaults(func=print_completion, prog=prog) j2y = s.add_parser('json2yaml', help='JSON to YAML conversion utility (stdin/stdout)') j2y.set_defaults(func=json2yaml) init = s.add_parser('init', help='Initialize credentials and contexts') init.add_argument('--cluster', help='Initialize contexts for all environments in a cluster') init.add_argument('--dry-run', '-n', action='store_true', help='print commands instead of running them') init.add_argument('env_name', metavar='ENV', nargs='?', help='environment to initialize') init.add_argument('--contexts-only', action='store_true', help='initialize contexts only, assuming that cluster credentials are set up') init.set_defaults(func=init_contexts) use = s.add_parser('use', help='switch kube context to the specified environment') use.add_argument('env', metavar='ENV', help='environment name') use.set_defaults(func=use_env_context) lint = s.add_parser('lint', help='inspect the contents of a release, exits with non-0 if there are issues') lint.add_argument('--cluster', help='Lint all environments in a cluster') lint.add_argument('env_name', metavar='ENV', nargs='?', help='environment name') lint.set_defaults(func=lint_environment) return p def verbose_log_level(v): if v == 0: return logging.WARNING if v == 1: return logging.INFO return logging.DEBUG def print_completion(prog, **kwargs): shell = os.path.basename(os.getenv('SHELL')) if shell == 'bash' or shell == 'tcsh': sys.stdout.write(argcomplete.shellcode(prog, shell=shell)) def main(): p = parser() argcomplete.autocomplete(p) args = p.parse_args() kwargs = args.__dict__ if 'func' not in kwargs: p.print_help(sys.stderr) sys.exit(1) func = kwargs['func'] del (kwargs['func']) logging.basicConfig(stream=sys.stderr, format='{levelname} {message}', style='{', level=verbose_log_level(args.verbose)) try: func(**kwargs) except CliError as e: print('{t.red}ERROR{t.normal}: {msg}'.format(msg=str(e), t=t), file=sys.stderr) if __name__ == '__main__': main()
[ "stig@zedge.net" ]
stig@zedge.net
7a0b60792ed25223de52fbb3b5be3e40333b2e4a
01a8424a51d61649a19128c446fbcc3e83d3d484
/accounts/views.py
d39fa08d3f65bbeae235c1836e07b2b672b1aebb
[]
no_license
MarkyMOD/Real_Estate_Website
c25c68560a1cc294de17f97dee2535090155a27a
97450fedfb597e865718aa09220949614f6c80de
refs/heads/master
2022-12-23T21:35:30.129225
2019-07-11T21:12:01
2019-07-11T21:12:01
163,868,044
0
0
null
2022-11-22T03:11:06
2019-01-02T17:05:00
Python
UTF-8
Python
false
false
2,857
py
from django.shortcuts import render, redirect from django.contrib import messages, auth from django.contrib.auth.models import User from contacts.models import Contact # Create your views here. def register(request): if request.method == 'POST': # Get form values first_name = request.POST['first_name'] last_name = request.POST['last_name'] username = request.POST['username'] email = request.POST['email'] password = request.POST['password'] password2 = request.POST['password2'] # Check if Passwords Match if password == password2: # Check Username if User.objects.filter(username=username).exists(): messages.error(request, 'That username is taken') return redirect('register') else: # Check Email if User.objects.filter(email=email).exists(): messages.error(request, 'That email is being used') return redirect('register') else: # Looks Good user = User.objects.create_user(username=username, password=password, email=email, first_name=first_name, last_name=last_name) # Login After Register auth.login(request, user) messages.success(request, 'You are now logged in') return redirect('index') # If You Don't Want to Login After Register # user.save() # messages.success(request, 'You are now registered and can log in') # return redirect('login') else: messages.error(request, 'Passwords do not match') return redirect('register') else: return render(request, 'accounts/register.html') def login(request): if request.method == 'POST': # Login username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username=username, password=password) if user is not None: auth.login(request, user) messages.success(request, 'You are now logged in') return redirect('dashboard') else: messages.error(request, 'Invalid credential') return redirect('login') else: return render(request, 'accounts/login.html') def logout(request): if request.method == 'POST': auth.logout(request) messages.success(request, 'You are now logged out') return redirect('index') def dashboard(request): user_contacts = Contact.objects.order_by('-contact_date').filter(user_id=request.user.id) context = { 'contacts': user_contacts } return render(request, 'accounts/dashboard.html', context)
[ "strictlybusinessemail242@gmail.com" ]
strictlybusinessemail242@gmail.com
ea2bfba36cf210900ac9c97e85fdeeed2b902033
bbd1b7f86e39f7bd3daf5d86ccdaa388a5fd0d74
/decision_tree.py
836cdea55e29220b46599851d387fc91e0932d38
[]
no_license
westernmeadow/CS4210Assignment1
de7a7d72a0e16543cd0210c4a9d5079d77fe4a1c
add2b1c29befed4b87a4ec5f7bb4cb09693df233
refs/heads/main
2023-04-13T17:53:04.402556
2021-04-09T21:32:58
2021-04-09T21:32:58
356,402,971
0
0
null
null
null
null
UTF-8
Python
false
false
2,053
py
#------------------------------------------------------------------------- # AUTHOR: Wesley Kwan # FILENAME: decision_tree # SPECIFICATION: ID3 algorithm for contact lens data # FOR: CS 4200- Assignment #1 # TIME SPENT: 30 min #-----------------------------------------------------------*/ #IMPORTANT NOTE: DO NOT USE ANY ADVANCED PYTHON LIBRARY TO COMPLETE THIS CODE SUCH AS numpy OR pandas. You have to work here only with standard vectors and arrays #importing some Python libraries from sklearn import tree import matplotlib.pyplot as plt import csv db = [] X = [] Y = [] #reading the data in a csv file with open('contact_lens.csv', 'r') as csvfile: reader = csv.reader(csvfile) for i, row in enumerate(reader): if i > 0: #skipping the header db.append (row) print(row) #transform the original training features to numbers and add to the 4D array X. For instance Young = 1, Prepresbyopic = 2, Presbyopic = 3, so X = [[1, 1, 1, 1], [2, 2, 2, 2], ...]] #--> add your Python code here # X = for instance in db: transform = [] for attribute in range(len(instance)-1): if instance[attribute] in ('Young', 'Myope', 'No', 'Reduced'): transform.append(1) elif instance[attribute] in ('Prepresbyopic', 'Hypermetrope', 'Yes', 'Normal'): transform.append(2) else: transform.append(3) X.append(transform) print(X) #transform the original training classes to numbers and add to the vector Y. For instance Yes = 1, No = 2, so Y = [1, 1, 2, 2, ...] #--> addd your Python code here # Y = for instance in db: if instance[len(instance)-1] == 'Yes': Y.append(1) else: Y.append(2) #fitting the decision tree to the data clf = tree.DecisionTreeClassifier(criterion = 'entropy') clf = clf.fit(X, Y) #plotting the decision tree tree.plot_tree(clf, feature_names=['Age', 'Spectacle', 'Astigmatism', 'Tear'], class_names=['Yes','No'], filled=True, rounded=True) plt.show()
[ "noreply@github.com" ]
westernmeadow.noreply@github.com
0235c874286b4bdd4f3f54cb7327d8aef8741517
74e5b97fd7ead5f2d0a37c03c5109f23e05e2da4
/write_csv.py
6d4243b7f4831de6ad8c133adb4a60a4bf4253eb
[]
no_license
Dream-991029/Lago
e3c173e1d61389f8de729499d4234a5ebf361df6
0f7c87bddc0a981a898adc92d631bcb6a37db723
refs/heads/master
2023-07-23T20:12:08.712517
2021-09-10T06:03:23
2021-09-10T06:03:23
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,134
py
import csv from typing import List, NoReturn class Csv(object): """ 封装csv写入类。 该类包含列表嵌套字典所涉及到的一些常用属性。 属性: file_path: string类型的目标文件路径 data_list: list类型的数据 count: int类型计数器 """ def __init__(self) -> NoReturn: pass def append_csv(self, file_path: str, data_list: List, count: int) -> int: """ 创建csv并追加数据 :param file_path: 目标文件路径 :param data_list: 数据列表(列表嵌套字典) :param count: 计数器 :return num: 返回最终计数器数量 """ with open(file_path, 'w+', encoding='GBK', newline='') as file: f_csv = csv.DictWriter(file, data_list[0].keys()) # 回退指针到首行 file.seek(0) if file.readline().strip("\n") == "": f_csv.writeheader() f_csv.writerows(data_list) num = count + len(data_list) print(f"{num}条数据, 写入完成!!!!!") return num
[ "981846339@qq.com" ]
981846339@qq.com
43471736de06cb51b5cd20be7f2654515cc9d4f7
c074333c90e682646e49d4d9a085ac7cc265d3d5
/mysite/polls/models.py
487cee3c09377a9c7f07f528e879d105f100ab1f
[]
no_license
kHarshit/django_tutorial
0bc9d15128621dabdabe7cd0f53a74a3baacf482
75bcdcf88dcd96076bdcf10ddcdca495784dca10
refs/heads/master
2020-05-28T13:20:10.285152
2017-02-20T18:57:49
2017-02-20T18:57:49
82,591,096
0
0
null
null
null
null
UTF-8
Python
false
false
967
py
from __future__ import unicode_literals import datetime from django.db import models from django.utils import timezone # Create your models here. class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __str__(self): return self.question_text def was_published_recently(self): return timezone.now() - datetime.timedelta(days=1) <= self.pub_date <= timezone.now() # return self.pub_date >= timezone.now() - datetime.timedelta(days=1) was_published_recently.admin_order_field = 'pub_date' was_published_recently.boolean = True was_published_recently.short_description = 'Published recently?' class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text
[ "harshitk.997@gmail.com" ]
harshitk.997@gmail.com
db2708b2709b6d896c466cb05bbf921c3dac4c93
5be7ca1d2ee8353f966d50dd0957cad08c32d1d6
/assignments/web_practice/second_practice/po_weixin/testcases/test_addcontact.py
0373dcb2620bbcd4795a3893da387a2341ea419e
[]
no_license
InsaneLoafer/HogwartsLG4_ZT
48a6b1d578bad48c92b541abb862dcb17c6d338e
870c66565e34329122a7d1953035718c251c00e0
refs/heads/master
2023-01-14T13:40:37.264260
2020-11-22T09:40:29
2020-11-22T09:40:29
310,861,090
0
0
null
null
null
null
UTF-8
Python
false
false
1,088
py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2020/11/8 20:41 # @Author : ZhangTao # @File : test_addcontact.py import allure import pytest from assignments.web_practice.second_practice.po_weixin.pages.index_pages.index_page import IndexPage @allure.feature('测试添加成员') class TestAddContact: username = 'aa' acctid = '1234' member_tel = '13411111111' def setup(self): self.index = IndexPage() @allure.story("测试添加成员") def test_addmember(self): # 赋值addmember with allure.step("点击添加成员"): addmember = self.index.click_add_member() # 进行addmember with allure.step("输入成员姓名、账号、电话号码"): addmember.add_member(self.username, self.acctid, self.member_tel) # 添加成员姓名到报告中 allure.attach(self.username, '成员姓名', attachment_type=allure.attachment_type.TEXT ) assert addmember.get_member(self.username) if __name__ == '__main__': pytest.main('-v', 'test_addcontact.py')
[ "Insane_Loafer@163.com" ]
Insane_Loafer@163.com
9bbca53ee48cb4bac59c71ec6959ecf7494d0554
039ad6224e8954f5889a388c5fd09faf53892746
/socket-service/server/room.py
20a71e662626d8470f5ade9f2ac66baa72908dfe
[ "MIT" ]
permissive
TheSmartMonkey/codenames
f70b0166f456d862409d5dc65d3de38daf86083f
a39946c8c705d50548f655838e4d32525c211e30
refs/heads/master
2023-04-22T05:49:41.586522
2020-05-12T19:29:03
2020-05-12T19:29:03
256,967,291
2
0
MIT
2021-05-06T20:05:19
2020-04-19T10:05:13
JavaScript
UTF-8
Python
false
false
2,129
py
import uuid from types import SimpleNamespace from game import CodenamesGame from random import sample class Room(object): def __init__(self): self.roomid=uuid.uuid1().hex self.players={} self.game=None def addPlayer(self,playername,avatar,isAdmin): if playername not in self.players: team=sample(("blue","red"),1)[0] if len(self.players)==0: role=sample(("spymaster","player"),1)[0] elif self.teamHasRole(team,"spymaster"): if self.teamHasRole(team,"player"): team=[t for t in ("blue","red") if t!=team][0] if self.teamHasRole(team,"spymaster"): role="player" else: role="spymaster" else: role="player" else: role="spymaster" self.players[playername]=SimpleNamespace( name=playername, avatar=avatar, team=team, isAdmin=isAdmin, role=role, isReady=isAdmin) return self.players[playername] def teamHasRole(self,team,role): return len([p for p in self.players.values() if p.team==team and p.role==role])>0 def deletePlayer(self,playername): del self.players[playername] def assignTeam(self,playername,team): self.players[playername].team=team return self.players[playername].__dict__ def assignRole(self,playername,role): self.players[playername].role=role return self.players[playername].__dict__ def getRole(self,playername): return self.players[playername].role def getPlayers(self): return [player.__dict__ for player in self.players.values()] def changePlayerStatus(self,playername,isReady): self.players[playername].isReady=isReady return self.players[playername].__dict__ def createGame(self,language): self.game=CodenamesGame(language) return self.game
[ "gilles.vandelle@kelkoo.com" ]
gilles.vandelle@kelkoo.com
89b107a01160959d3a7d92a2f824a53b46849515
7df7642c30f0cd09db47c42abe2738a00d8c9562
/hearthstone/deckstrings.py
bb7ffc3007aa14a8b418ea181aab3366577b118e
[ "MIT" ]
permissive
mshirinyan/python-hearthstone
601887c49385f041acd0c98c23170269b29ff5f5
3855e9565d45f0a5677fffe2f88cbe160cc6c7e1
refs/heads/master
2021-09-07T12:33:05.479242
2018-02-14T12:33:20
2018-02-14T16:05:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,991
py
""" Blizzard Deckstring format support """ import base64 from io import BytesIO from .enums import FormatType DECKSTRING_VERSION = 1 def _read_varint(stream): shift = 0 result = 0 while True: c = stream.read(1) if c == "": raise EOFError("Unexpected EOF while reading varint") i = ord(c) result |= (i & 0x7f) << shift shift += 7 if not (i & 0x80): break return result def _write_varint(stream, i): buf = b"" while True: towrite = i & 0x7f i >>= 7 if i: buf += bytes((towrite | 0x80, )) else: buf += bytes((towrite, )) break return stream.write(buf) class Deck: @classmethod def from_deckstring(cls, deckstring): instance = cls() instance.cards, instance.heroes, instance.format = parse_deckstring(deckstring) return instance @property def as_deckstring(self): return write_deckstring(self.cards, self.heroes, self.format) def get_dbf_id_list(self): return sorted(self.cards, key=lambda x: x[0]) def trisort_cards(cards): cards_x1, cards_x2, cards_xn = [], [], [] for cardid, count in cards: if count == 1: list = cards_x1 elif count == 2: list = cards_x2 else: list = cards_xn list.append((cardid, count)) return cards_x1, cards_x2, cards_xn def parse_deckstring(deckstring): decoded = base64.b64decode(deckstring) data = BytesIO(decoded) if data.read(1) != b"\0": raise ValueError("Invalid deckstring") version = _read_varint(data) if version != DECKSTRING_VERSION: raise ValueError("Unsupported deckstring version %r" % (version)) format = _read_varint(data) try: format = FormatType(format) except ValueError: raise ValueError("Unsupported FormatType in deckstring %r" % (format)) heroes = [] num_heroes = _read_varint(data) for i in range(num_heroes): heroes.append(_read_varint(data)) cards = [] num_cards_x1 = _read_varint(data) for i in range(num_cards_x1): card_id = _read_varint(data) cards.append((card_id, 1)) num_cards_x2 = _read_varint(data) for i in range(num_cards_x2): card_id = _read_varint(data) cards.append((card_id, 2)) num_cards_xn = _read_varint(data) for i in range(num_cards_xn): card_id = _read_varint(data) count = _read_varint(data) cards.append((card_id, count)) return cards, heroes, format def write_deckstring(cards, heroes, format): data = BytesIO() data.write(b"\0") _write_varint(data, DECKSTRING_VERSION) _write_varint(data, int(format)) if len(heroes) != 1: raise ValueError("Unsupported hero count %i" % (len(heroes))) _write_varint(data, len(heroes)) for hero in heroes: _write_varint(data, hero) cards_x1, cards_x2, cards_xn = trisort_cards(cards) for cardlist in cards_x1, cards_x2: _write_varint(data, len(cardlist)) for cardid, _ in cardlist: _write_varint(data, cardid) _write_varint(data, len(cards_xn)) for cardid, count in cards_xn: _write_varint(data, cardid) _write_varint(data, count) encoded = base64.b64encode(data.getvalue()) return encoded.decode("utf-8")
[ "jerome@leclan.ch" ]
jerome@leclan.ch
d9b2635bc34362ceaa4eafae793347d0f853fb78
df4fa533c14ad84db4c69f3a029210874676c84a
/set4/print orime numbers in given range.py
1b40b57dbae85559479b733287c4f2318c9081c6
[]
no_license
JagadeeshMandala/python-programs
f9f5376092e2d1cf02e35a22fcedaab7fe842cdd
07934980d3f971e390b1a0a641a002170a7ed0bd
refs/heads/master
2023-08-28T21:04:29.446639
2021-11-03T05:52:53
2021-11-03T05:52:53
424,103,122
0
1
null
null
null
null
UTF-8
Python
false
false
289
py
lower=int(input("enter the lower range of number")) higher=int(input("enter the higher range of number")) for num in range(lower,higher+1): if num>1: for i in range(2,num): if num%i==0: break else: print(num,end=" ")
[ "jagadeeshmandala888@gmail.com" ]
jagadeeshmandala888@gmail.com
3ed6ce16285c35d94d8e6e78dde18c2cacac5da4
36746a067069f974056c562c0af559576c598497
/scraper_karriera.py
5ed8b15635859273e0f586401a387a88bb1e1a54
[]
no_license
calogerobra/job_portal_scraper_medium_js
042ac2867722e6cc2f36b104f40400693c7553e3
1ed3023bb18e626ddfcf53faf5dfd5e9bb2ecae6
refs/heads/main
2023-06-30T10:27:13.273603
2021-08-05T15:37:02
2021-08-05T15:37:02
393,088,796
0
0
null
null
null
null
UTF-8
Python
false
false
15,473
py
# Import general libraries import datetime import pandas as pd from bs4 import BeautifulSoup as soup import time import csv import requests requests.packages.urllib3.disable_warnings() import random # Improt Selenium packages from selenium import webdriver from selenium.common.exceptions import NoSuchElementException as NoSuchElementException from selenium.common.exceptions import WebDriverException as WebDriverException from selenium.common.exceptions import ElementNotVisibleException as ElementNotVisibleException from selenium.webdriver.chrome.options import Options def request_page(url_string, verification, robust): """HTTP GET Request to URL. Args: url_string (str): The URL to request. verification: Boolean certificate is to be verified robust: If to be run in robust mode to recover blocking Returns: HTML code """ if robust: loop = False first = True # Scrape contents in recovery mode c = 0 while loop or first: first = False try: uclient = requests.get(url_string, timeout = 60, verify = verification) page_html = uclient.text loop = False return page_html except requests.exceptions.ConnectionError: c += 10 print("Request blocked, .. waiting and continuing...") time.sleep(random.randint(10,60) + c) loop = True continue except (requests.exceptions.ReadTimeout,requests.exceptions.ConnectTimeout): print("Request timed out, .. waiting one minute and continuing...") time.sleep(60) loop = True continue else: uclient = requests.get(url_string, timeout = 60, verify = verification) page_html = uclient.text loop = False return page_html def request_page_fromselenium(url_string, driver, robust): """ Request HTML source code from Selenium web driver to circumvent mechanisms active with HTTP requests Args: Selenium web driver URL string Returns: HTML code """ if robust: loop = False first = True # Scrape contents in recovery mode c = 0 while loop or first: first = False try: open_webpage(driver, url_string) time.sleep(5) page_html = driver.page_source loop = False return page_html except WebDriverException: c += 10 print("Web Driver problem, .. waiting and continuing...") time.sleep(random.randint(10,60) + c) loop = True continue else: open_webpage(driver, url_string) time.sleep(5) page_html = driver.page_source loop = False return page_html def set_driver(webdriverpath, headless): """Opens a webpage in Chrome. Args: url of webpage. Returns: open and maximized window of Chrome with webpage. """ options = Options() if headless: options.add_argument("--headless") elif not headless: options.add_argument("--none") return webdriver.Chrome(webdriverpath, chrome_options = options) def create_object_soup(object_link, verification, robust): """ Create page soup out of an object link for a product Args: Object link certificate verification parameter robustness parameter Returns: tuple of beautiful soup object and object_link """ object_soup = soup(request_page(object_link, verification, robust), 'html.parser') return (object_soup, object_link) def make_soup(link, verification): """ Create soup of listing-specific webpage Args: object_id Returns: soup element containing listings-specific information """ return soup(request_page(link, verification), 'html.parser') def reveal_all_items(driver): """ Reveal all items on the categroy web page of Albert Heijn by clicking "continue" Args: Selenium web driver Returns: Boolean if all items have been revealed """ hidden = True while hidden: try: time.sleep(random.randint(5,7)) driver.find_element_by_css_selector('section#listing-home div.col-md-6.customlistinghome > a').click() except (NoSuchElementException, ElementNotVisibleException): hidden = False return True def open_webpage(driver, url): """Opens web page Args: web driver from previous fct and URL Returns: opened and maximized webpage """ driver.set_page_load_timeout(60) driver.get(url) driver.maximize_window() def extract_listings_pages(first_page_html): """ Extract pages using pagecount field on karriera page Args: URL Robustness parameter Certification verification parameter Returns: listings """ # Extract pages pc_soup = soup(first_page_html, 'html.parser') pc_list = pc_soup.findAll('div',{'class': 'pagination-nav'})[0].findAll('a', {'class': 'g-button no-text number'}) # Extract days online return ['http://karriera.al/' + pc['href'] for pc in pc_list] def make_jobs_list(base_url, robust, driver): """ Extract item URL links + front information and return list of all item links on web page Args: Base URL Categroy tuples Certificate verification parameter Robustness parameter Selenium web driver Returns: Dictionary with item URLs """ print("Start retrieving item links...") on_repeat = False first_run = True front_contents = [] while on_repeat or first_run: first_run = False open_webpage(driver, base_url) # Extract first page_html first_page_html = driver.page_source # Extract page count and loop over pages pages = [driver.current_url] pages = pages + extract_listings_pages(first_page_html) # Loop over pages for page in pages: time.sleep(1) # Within each page extract list of link, views, job city and days online open_webpage(driver, page) page_html = driver.page_source page_soup = soup(page_html, 'html.parser') front_content_container = page_soup.findAll('div', {'class': 'result-left col-sm-8 col-xs-12'})[0].table.tbody.findAll('tr') for container in front_content_container: container_content = container.findAll('td') link = 'http://karriera.al' + container_content[0].a['href'] job_city = container_content[1].text days_online = container_content[2].text views = container_content[3].text front_content = [link, job_city, days_online, views] front_contents.append(front_content) print('Retrieved', len(front_contents), 'item links!') return front_contents def create_elements(front_content_container, verification, robust): """Extracts the relevant information form the html container, i.e. object_id, Args: A container element + region, city, districts, url_string. Returns: A dictionary containing the information for one listing. """ object_soup = create_object_soup(front_content_container[0], verification, robust)[0] object_link = front_content_container[0] # Insert information from above job_city = front_content_container[1] days_online = front_content_container[2] views = front_content_container[3] # Parse contents try: content_container = object_soup.findAll('body', {'class': 'al'})[0].findAll('div', {'id': 'wrapper'})[0].findAll('div', {'class': 'post-job'})[0] except: content_container = [] try: company_name = content_container.findAll('div', {'class': 'job-txt'})[0].h5.text except: company_name = "" try: contact_details_container = content_container.findAll('div', {'class': 'job-txt'})[0].ul.findAll('li') contact_details = '|'.join([i.text for i in contact_details_container]) except: contact_details = '' try: company_details_container = content_container.findAll('div', {'class':'row job-inside clear'})[0] assert company_details_container.a.text == 'Rreth nesh' company_details = company_details_container.p.text except: company_details = "" try: object_id_container = object_link.split('/') object_id = object_id_container[5] except: object_id = "" try: job_category_container = content_container.findAll('div', {'class': 'col-sm-6 col-xs-12'})[0] assert job_category_container.a.text == 'Kategoria' job_category = job_category_container.span.text except: job_category = "" try: contract_type_container = content_container.findAll('div', {'class': 'col-sm-6 col-xs-12'})[1] assert contract_type_container.a.text == 'Lloji i punës' contract_type = contract_type_container.span.text except: contract_type = "" # Flexibly extract job description job_description = "" for i in range(0,5): try: job_description_container = content_container.findAll('div', {'class': 'col-sm-12 col-xs-12'})[i] assert job_description_container.a.text == 'Përshkrimi i Punës' job_description = job_description_container.p.text break except AssertionError: job_description = "" # Flexibly extract job title job_title = "" for i in range(0,5): try: job_title_container = content_container.findAll('div', {'class': 'col-sm-12 col-xs-12'})[i] assert job_title_container.a.text == 'Titulli i postimit *' job_title = job_title_container.span.text break except AssertionError: job_title = "" # Flexibly extract requirements requirements = "" for i in range(0,5): try: requirements_container = content_container.findAll('div', {'class': 'col-sm-12 col-xs-12'})[i] assert requirements_container.a.text == 'Kërkesat e profilit' requirements = requirements_container.p.text break except: requirements = "" # Flexibly extract salary salary = "" for i in range(0,5): try: salary_container = content_container.findAll('div', {'class': 'col-sm-12 col-xs-12'})[i] assert salary_container.a.text == 'Paga' salary = salary_container.span.text break except: salary = "" # Flexibly extract additional information add_information = "" for i in range(0,5): try: add_information_container = content_container.findAll('div', {'class': 'col-sm-12 col-xs-12'})[i] assert add_information_container.a.text == 'Tjetër (Opsionale)' add_information = add_information_container.p.text break except: add_information = "" page_html = object_soup.prettify() # Create a dictionary as output return dict([("object_link", object_link), ("job_city", job_city), ("days_online", days_online), ("views", views), ("company_name", company_name), ("company_details", company_details), ("contact_details", contact_details), ("object_id", object_id), ("job_title", job_title), ("job_category", job_category), ("contract_type", contract_type), ("job_description", job_description), ("requirements", requirements), ("salary", salary), ("page_html", page_html), ("add_information", add_information)]) def scrape_karriera(verification, robust, front_contents): """Scraper for karriera job portal based on specified parameters. In the following we would like to extract all the containers containing the information on one listing. For this purpose we try to parse through the html text and search for all elements of interest. Args: verification robust item_links Returns: Appended pandas dataframe with crawled content. """ # Define dictionary for output input_dict = {} frames = [] counter = 0 #skipper = 0 # Loop links for front_content in front_contents: time.sleep(random.randint(1,2)) print('Parsing URL', front_content[0]) # Set scraping time now = datetime.datetime.now() try: input_dict.update(create_elements(front_content, verification, robust)) time.sleep(0.5) # Create a dataframe df = pd.DataFrame(data = input_dict, index =[now]) df.index.names = ['scraping_time'] frames.append(df) except requests.exceptions.ConnectionError: error_message = "Connection was interrupted, waiting a few moments before continuing..." print(error_message) time.sleep(random.randint(2,5) + counter) continue return pd.concat(frames).drop_duplicates(subset = 'object_link') def main(): """ Note: Set parameters in this function """ # Set time stamp now_str = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") # Set scraping parameters base_url = 'http://karriera.al/al/result' robust = True webdriverpath = r"C:\Users\\Calogero\Documents\GitHub\job_portal_scraper_medium_js\chromedriver.exe" # Set up a web driver driver = set_driver(webdriverpath, False) # Start timer start_time = time.time() # Capture start and end time for performance # Set verification setting for certifiates of webpage. Check later also certification verification = True # Execute functions for scraping start_time = time.time() # Capture start and end time for performance item_links = make_jobs_list(base_url, robust, driver) driver.close() appended_data = scrape_karriera(verification, robust, item_links) # Split off HTML code for Giannis and team appended_data = appended_data.drop("page_html",1) # Write output to Excel print("Writing to Excel file...") time.sleep(1) file_name = '_'.join(['C:\\Users\\Calogero\\Documents\\GitHub\\job_portal_scraper_medium_js\\data\\daily_scraping\\' + str(now_str), 'karriera.xlsx']) writer = pd.ExcelWriter(file_name, engine='xlsxwriter') appended_data.to_excel(writer, sheet_name = 'jobs') writer.save() # Write to CSV print("Writing to CSV file...") appended_data.to_csv(file_name.replace('.xlsx', '.csv'), sep =";",quoting=csv.QUOTE_ALL) end_time = time.time() duration = time.strftime("%H:%M:%S", time.gmtime(end_time - start_time)) # For interaction and error handling final_text = "Your query was successful! Time elapsed:" + str(duration) print(final_text) time.sleep(0.5) # Execute scraping if __name__ == "__main__": main()
[ "70377216+calogerobra@users.noreply.github.com" ]
70377216+calogerobra@users.noreply.github.com
0599ad0639d06d818def4fa99b5cb87567b0b85f
5ad255257f58705b8ce28121c0cc0d1000af1077
/CI/1.Epopcon/intern/CI_company_category_dashboard/src/CI_company_category_dashboard.py
ed400d654387018b8ccfbe84c71ea5740685144d
[]
no_license
benepopds/epop_poi
92e4301dbfbecf676f5b154d7b43108dff9ab82f
153e5ef423e6a76f01037fe06ce354a6dc2268a7
refs/heads/master
2020-03-22T23:45:30.533090
2018-10-31T07:30:24
2018-10-31T07:30:24
140,827,236
1
4
null
2018-08-17T07:27:52
2018-07-13T09:31:18
Python
UTF-8
Python
false
false
17,907
py
import dash from dash.dependencies import Input, Output, State import dash_core_components as dcc import dash_html_components as html import dash_table_experiments as dt import plotly.graph_objs as go import plotly.plotly as py import squarify import json import pandas as pd import numpy as np import plotly import pickle import datetime #import dash_auth import dash_auth from sqlalchemy import create_engine import pymysql, pandas as pd pymysql.install_as_MySQLdb() import MySQLdb df = pd.read_parquet('TEMP_COMPANY_REFINE.PQ') modify_dict = {} VALID_USERNAME_PASSWORD_PAIRS = [ ['admin1', 'epop0313'], ['admin2', 'epop0313'], ['admin3', 'epop0313'], ] app = dash.Dash('auth') auth = dash_auth.BasicAuth( app, VALID_USERNAME_PASSWORD_PAIRS ) user_name = auth._username print(type(auth)) print(auth._username) print(type(auth._username)) ## PQ 파일 sync 맞추는 작업은 나중에 서버 올라가고 나서 코어 여러개 쓰는 방안 고민해보기 (패럴) #app = dash.Dash('auth') app.layout = html.Div([ html.Div([dt.DataTable(rows=[{}], id='dt_words_pair')], id='div_words_pair', className="container", style={'width':'40%', 'height':'100%','display':'inline-block'}), html.Div([html.Button(id='bt1', n_clicks=0, children="X" ) ], style={'text-align':'left', 'width':'10%', 'height':'100%', 'display': 'inline-block'}), html.Div([dt.DataTable(rows=[{}], id='dt_cate_pair'),], id='div_cate_pair', className="container", style={'width':'40%', 'height':'100%','display':'inline-block'}), html.Div([html.Div(id='my-div'),dcc.Input(id='cate', value='modify_cate', type='text'),dcc.Input(id='cate1', value='modify_cate1', type='text'), html.Button(id='bt2', n_clicks=0, children="modify" )],), html.Button(id='bt3', n_clicks=0, children = '상점찾기제외'), html.Button(id='bt4', n_clicks=0, children = 'Sync DB - PQ'), html.Div([dt.DataTable(rows=[{}], id='dt_pair_samples')], id='div_pair_samples', className="container", style={'width':'100%', 'height':'100%','display':'inline-block'}), html.Div(id='result_div'), html.Div(id='result_div2'), html.Div(id='result_div3'), html.Div(id='result_div4'), ], id='page', className="container", style={'text-align':'left', 'width':'100%', 'height':'100%','display':'inline-block'}) @app.callback( Output('result_div4', component_property='children'), [ Input('bt4', 'n_clicks')], ) def click_save_button(n_clicks): if n_clicks==0: return None engine = create_engine("mysql://eums:eums00!q@133.186.146.142:3306/eums-poi?charset=utf8mb4", encoding = 'utf8' , pool_size=50,pool_recycle=3600,connect_args={'connect_timeout':1000000} ) query = """select ID, CO_NAME, CO_NAME_R, REP_PHONE_NUM, ADDR, ROAD_ADDR, CATE_CODE, CATE, CATE1_CODE, CATE1, TAG, STATUS, MODIFIER, UPT_DT from TEMP_COMPANY """ df = pd.read_sql_query(query, engine) df.to_parquet('TEMP_COMPANY_REFINE.PQ') return 'PARQUET UPDATE SUCCESS' ## modify를 각 카테고리에서 가장 많은 count 로 업데이트 @app.callback( Output('cate', 'value'), [ Input('dt_words_pair', 'selected_row_indices') ], [ State('dt_words_pair', 'rows') ] ) ## modify를 각 카테고리에서 가장 많은 count 로 업데이트 def update_modify_cate(selected_row_indices, rows): if selected_row_indices == None or len(selected_row_indices) == 0: return 'modify_cate' result="" selected_rows = [rows[index] for index in selected_row_indices] w0, w1 = selected_rows[0]['pair'][0], selected_rows[0]['pair'][1] df2 = df[(df['CO_NAME_R'].str.contains('{}.*{}'.format(w0, w1) , regex = True, na = False )) & ((df['STATUS'] == '0' ) | (df['STATUS'] == '1'))] freq_cate = pd.DataFrame(df2.groupby(['CATE', 'CATE1']).CO_NAME.count()).reset_index().sort_values(by='CO_NAME', ascending=False) result = freq_cate['CATE'].values[0] return result ## modify1를 각 카테고리에서 가장 많은 count 로 업데이트 @app.callback( Output('cate1', 'value'), [ Input('dt_words_pair', 'selected_row_indices') ], [ State('dt_words_pair', 'rows') ] ) ## modify1를 각 카테고리에서 가장 많은 count 로 업데이트 def update_modify_cate1(selected_row_indices, rows): if selected_row_indices == None or len(selected_row_indices) == 0: return 'modify_cate1' result="" selected_rows = [rows[index] for index in selected_row_indices] w0, w1 = selected_rows[0]['pair'][0], selected_rows[0]['pair'][1] df2 = df[(df['CO_NAME_R'].str.contains('{}.*{}'.format(w0, w1) , regex = True, na = False )) & ((df['STATUS'] == '0' ) | (df['STATUS'] == '1'))] freq_cate = pd.DataFrame(df2.groupby(['CATE', 'CATE1']).CO_NAME.count()).reset_index().sort_values(by='CO_NAME', ascending=False) result = freq_cate['CATE1'].values[0] return result @app.callback( Output('result_div',component_property='children'), [Input('bt3', 'n_clicks'), Input('dt_pair_samples', 'selected_row_indices'), Input('dt_pair_samples', 'rows'),], [State('dt_cate_pair', 'selected_row_indices'), State('dt_cate_pair', 'rows'), State('dt_words_pair', 'selected_row_indices'), State('dt_words_pair', 'rows'), State('cate', 'value'), State('cate1','value')] ) def exclude_store(n_clicks, sample_indeces, sample_rows, cate_indeces, cate_rows, word_indeces, word_rows, modify_cate, modify_cate1): if cate_indeces == None or len(cate_indeces) == 0: return "" if word_indeces == None or len(word_indeces) == 0: return "" if modify_cate == None or modify_cate1 == None or n_clicks == 0: return "" sel_word = [word_rows[i] for i in word_indeces][0] sel_cate = [cate_rows[i] for i in cate_indeces][0] w0 = sel_word['pair'][0] #내가찍은 pair 1 w1 = sel_word['pair'][1] #내가찍은 pair 2 cate_select = sel_cate['CATE'] #내가찍은 cate cate1_select = sel_cate['CATE1'] #내가찍은 cate1 print(w0, w1, cate_select, cate1_select) print('## test!!! ') print(sample_indeces) print(type(sample_indeces)) engine = create_engine("mysql://eums:eums00!q@133.186.146.142:3306/eums-poi?charset=utf8mb4", encoding = 'utf8' , pool_size=50,pool_recycle=3600,connect_args={'connect_timeout':1000000} ) #기존 CATE_CODE 가져옴 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '' """.format(cate_select)#, modify_cate1) select_cate_code = pd.read_sql_query(code_query, engine) before_cate_code = select_cate_code['CODE'][0] #기존 CATE_CODE1 가져옴 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '{}' """.format(cate1_select, before_cate_code) if cate1_select == "": before_cate1_code = "" else: select_cate1_code = pd.read_sql_query(code_query, engine) before_cate1_code = select_cate1_code['CODE'][0] for i in range(0, len(sample_indeces)): c = df[(df['CO_NAME'] == sample_rows[i]['CO_NAME']) & (df['REP_PHONE_NUM'] == sample_rows[i]['REP_PHONE_NUM']) & (df['CATE'] == cate_select) & (df['CATE1'] == cate1_select) & ( (df['STATUS'] == '0') | (df['STATUS'] == '1' ) ) ] company_id = c['ID'].values[0] origin_status = c['STATUS'].values[0] query = """ UPDATE TEMP_COMPANY SET STATUS = "{}", UPT_DT = "{}", MODIFIER = "{}" where (STATUS=1 or STATUS=0) and CO_NAME = "{}" and REP_PHONE_NUM = "{}" and CATE="{}" and CATE1="{}" """.format(-9, datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),auth._username, sample_rows[i]['CO_NAME'], sample_rows[i]['REP_PHONE_NUM'],cate_select, cate1_select) print(query) with engine.connect() as con: con.execute(query) query2 = """ INSERT INTO TEMP_COMPANY_EXCLUDE_HISTORY SET COMPANY_ID = '{}', CO_NAME = '{}', CATE_CODE = '{}',CATE1_CODE = '{}', CATE = '{}', CATE1 = '{}', STATUS = '{}', MODIFIER = '{}', UPT_DT = '{}' """.format(company_id, sample_rows[i]['CO_NAME'], before_cate_code, before_cate1_code, cate_select,cate1_select,origin_status ,auth._username ,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) print(query2) with engine.connect() as con: con.execute(query2) return '선택하신 정보의 STATUS 를 -9로 변경하였습니다.' ## DB값을 실제로 업데이트 @app.callback( Output('result_div2', component_property='children'), [Input('bt2', 'n_clicks'),], [State('dt_cate_pair', 'selected_row_indices'), State('dt_cate_pair', 'rows'), State('dt_words_pair', 'selected_row_indices'), State('dt_words_pair', 'rows'), State('dt_pair_samples', 'selected_row_indices'), State('dt_pair_samples', 'rows'), State('cate', 'value'), State('cate1','value')] ) ## DB값을 실제로 업데이트 def modify_print(n_clicks, cate_indeces, cate_rows, word_indeces, word_rows, sample_indeces, sample_rows, modify_cate, modify_cate1): if cate_indeces == None or len(cate_indeces) == 0: return None if word_indeces == None or len(word_indeces) == 0: return None if modify_cate == None or modify_cate1 == None or n_clicks == 0: return None print(cate_indeces, len(cate_rows), word_indeces, len(word_rows)) sel_word = [word_rows[i] for i in word_indeces][0] sel_cate = [cate_rows[i] for i in cate_indeces][0] w0 = sel_word['pair'][0] #내가찍은 pair 1 w1 = sel_word['pair'][1] #내가찍은 pair 2 cate_select = sel_cate['CATE'] #내가찍은 cate cate1_select = sel_cate['CATE1'] #내가찍은 cate1 print(w0, w1, cate_select, cate1_select) print('## test!!! ') print(sample_indeces) print(type(sample_indeces)) engine = create_engine("mysql://eums:eums00!q@133.186.146.142:3306/eums-poi?charset=utf8mb4", encoding = 'utf8' , pool_size=50,pool_recycle=3600,connect_args={'connect_timeout':1000000} ) #UPDATE 할 CATE_CODE 가져옴 #cate_code = 바꿀 카테의 코드 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '' """.format(modify_cate)#, modify_cate1) modi_cate_code = pd.read_sql_query(code_query, engine) after_cate_code = modi_cate_code['CODE'][0] #UPDATE 할 CATE_CODE1 가져옴 #cate1_code = 바꿀 카테1의 코드 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '{}' """.format(modify_cate1, after_cate_code) if modify_cate1 =="": after_cate1_code = "" else: modi_cate1_code = pd.read_sql_query(code_query, engine) after_cate1_code = modi_cate1_code['CODE'][0] #UPDATE 전 CATE_CODE 가져옴 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '' """.format(cate_select)#, modify_cate1) select_cate_code = pd.read_sql_query(code_query, engine) before_cate_code = select_cate_code['CODE'][0] #UPDATE 전 CATE_CODE1 가져옴 #cate1_code = 바꿀 카테1의 코드 code_query = """select CODE from MEUMS_CODE where CODE_NAME = '{}' and GROUP_CODE = 'COMPCATE' and UPPER_CODE = '{}' """.format(cate1_select, before_cate_code) if cate1_select == "": before_cate1_code = "" else: select_cate1_code = pd.read_sql_query(code_query, engine) before_cate1_code = select_cate1_code['CODE'][0] for i in range(0, len(sample_indeces)): c = df[(df['CO_NAME'] == sample_rows[i]['CO_NAME']) & (df['REP_PHONE_NUM'] == sample_rows[i]['REP_PHONE_NUM']) & (df['CATE'] == cate_select) & (df['CATE1'] == cate1_select) & ( (df['STATUS']=='0') | (df['STATUS'] == '1') ) ] print('###') print(c) company_id = c['ID'].values[0] query = """ UPDATE TEMP_COMPANY SET CATE_CODE = "{}", CATE = "{}" , CATE1_CODE = "{}", CATE1 ="{}", UPT_DT = "{}", MODIFIER = "{}" where (STATUS=1 or STATUS=0) and CO_NAME = "{}" and REP_PHONE_NUM = "{}" and CATE="{}" and CATE1="{}" """.format(after_cate_code, modify_cate, after_cate1_code, modify_cate1, datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),auth._username, sample_rows[i]['CO_NAME'], sample_rows[i]['REP_PHONE_NUM'],cate_select, cate1_select) print(query) with engine.connect() as con: con.execute(query) query2 = """ INSERT INTO TEMP_COMPANY_UPDATE_HISTORY SET COMPANY_ID = '{}', CO_NAME = '{}', PAIR1 = '{}', PAIR2 = '{}', ORG_CATE_CODE = '{}',ORG_CATE1_CODE = '{}', ORG_CATE = '{}', ORG_CATE1 = '{}', CATE_CODE = '{}', CATE1_CODE = '{}', CATE = '{}', CATE1 = '{}', MODIFIER = '{}', UPT_DT = '{}' """.format(company_id, sample_rows[i]['CO_NAME'], w0,w1,before_cate_code, before_cate1_code, cate_select,cate1_select,after_cate_code, after_cate1_code,modify_cate, modify_cate1,auth._username ,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) print(query2) with engine.connect() as con: con.execute(query2) return 'DB 수정 완료' #print div_cate_pair @app.callback( Output('div_cate_pair', 'children'), [ Input('dt_words_pair', 'selected_row_indices') ], [ State('dt_words_pair', 'rows') ] ) def cate_pairs(selected_row_indices, rows): if selected_row_indices == None or len(selected_row_indices) == 0: return None selected_rows = [rows[index] for index in selected_row_indices] w0, w1 = selected_rows[0]['pair'][0], selected_rows[0]['pair'][1] df2 = df[(df['CO_NAME_R'].str.contains('{}.*{}'.format(w0, w1) , regex = True, na = False )) & ((df['STATUS'] == '0' ) | (df['STATUS'] == '1'))] print(df2) freq_cate = pd.DataFrame(df2.groupby(['CATE', 'CATE1']).CO_NAME.count()).reset_index().sort_values(by='CO_NAME', ascending=False) freq_cate.columns = ['CATE', 'CATE1', 'COUNT'] return dt.DataTable( rows = freq_cate.to_dict('records'), #columns = ['pair', 'pair_str', 'cnt'], row_selectable=True, filterable=True, sortable=True, selected_row_indices=[], resizable=True, max_rows_in_viewport=5, editable=False, column_widths=[100,100,300], min_width=500, id='dt_cate_pair' ) #read pkl & show pair @app.callback( Output('div_words_pair', 'children'), [ Input('bt1', 'n_clicks') ], [ State('dt_words_pair', 'rows'), State('dt_words_pair', 'selected_row_indices') ] ) def loading_pairs(n_clicks, rows, selected_row_indices): if n_clicks == 0: print('n_clicks == 0') return dt.DataTable( rows = pc.to_dict('records'), columns = ['pair_str', 'cnt'], row_selectable=True, filterable=True, sortable=True, selected_row_indices=[], resizable=True, max_rows_in_viewport=5, #min_width=400, id='dt_words_pair' ) else: return None #select pair print @app.callback( Output('my-div',component_property='children'), [ Input('dt_words_pair', 'selected_row_indices') ], [ State('dt_words_pair', 'rows') ] ) def print_div(selected_row_indices, rows): if selected_row_indices == None or len(selected_row_indices) == 0: return None selected_rows = [rows[index] for index in selected_row_indices] w0, w1 = selected_rows[0]['pair'][0], selected_rows[0]['pair'][1] print (w0, w1) return w0, w1 #print select table @app.callback( Output('div_pair_samples', 'children'), [ Input('dt_cate_pair', 'selected_row_indices') ], [ State('dt_cate_pair', 'rows'), State('dt_words_pair', 'selected_row_indices'), State('dt_words_pair', 'rows') ] ) def querying_pairs(cate_indeces, cate_rows, word_indeces, word_rows): if cate_indeces == None or len(cate_indeces) == 0: return None if word_indeces == None or len(word_indeces) == 0: return None print(cate_indeces, len(cate_rows), word_indeces, len(word_rows)) sel_word = [word_rows[i] for i in word_indeces][0] sel_cate = [cate_rows[i] for i in cate_indeces][0] w0= sel_word['pair'][0] w1= sel_word['pair'][1] cate=sel_cate['CATE'] cate1=sel_cate['CATE1'] print(w0, w1, cate, cate1) df2 = df[(df['CO_NAME_R'].str.contains('{}.*{}'.format(w0, w1) , regex = True, na = False )) & ((df['STATUS'] == '0' ) | (df['STATUS'] == '1')) & (df['CATE'] == cate) & (df['CATE1'] == cate1)] df2 = df2[['CO_NAME', 'REP_PHONE_NUM', 'CATE', 'CATE1', 'TAG', 'ADDR', 'ROAD_ADDR']] return dt.DataTable( rows = df2.to_dict('records'), #columns = ['pair', 'pair_str', 'cnt'], row_selectable=True, filterable=True, sortable=True, selected_row_indices=[], resizable=True, max_rows_in_viewport=20, editable=False, column_widths=[300,100,80,100,400,350,350], min_width=1800, id='dt_pair_samples' ) app.css.append_css({ 'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css' }) if __name__ == '__main__': try: words_pair_count_dontcare = pickle.load(open('words_pair_count_dontcare.list.pkl', 'rb')) print('loading dontcare list') except: words_pair_count_dontcare = [] pc_list = pickle.load(open('words_pair_count_sorted.list.pkl', 'rb')) pc_list = pc_list[:2000] pc_list = [pce for pce in pc_list if pce not in words_pair_count_dontcare] pc = pd.DataFrame(pc_list, columns=['pair','cnt']) pc['pair_str'] = pc.pair.astype('str') print('## user name ##') print(user_name) app.run_server(debug=False, host='0.0.0.0', port=8050)
[ "rmsxor94@naver.com" ]
rmsxor94@naver.com
deba1e3f47315ccc1ff205db11a6c8001b565e86
0ad589622461664e446e0f3b0063d6a8ad988838
/thread.py
10a35e2e00e0e271a3f8d7cebfd3d6b614cfc29d
[]
no_license
mrlam99n01/vim_file
d166ca0bd663839780f8cec553a9952c73137615
37dca98fc4c4a747545c82e8dbe0a3d5ade55c46
refs/heads/master
2023-02-08T08:33:17.441322
2021-01-02T13:05:23
2021-01-02T13:05:23
326,182,576
0
0
null
null
null
null
UTF-8
Python
false
false
659
py
import time import concurrent.futures start = time.perf_counter() def do_something(seconds): print('Sleeping 1 second...') time.sleep(seconds) return 'Done something ... ' with concurrent.futures.ThreadPoolExecutor() as executor: results = [executor.submit(do_something,1) for _ in range(10)] for f in concurrent.futures.as_completed(results): print(f.result()) threads = [] # for _ in range(10): # t = threading.Thread(target=do_something,args=[1.5]) # t.start() # threads.append(t) # for thread in threads: # thread.join() finish = time.perf_counter() print(f'Finish in {round(finish-start,2)} second(s)')
[ "mrlam99n01@gmail.com" ]
mrlam99n01@gmail.com
ce1a0986a077a61178984b37c1a0e8b95eaab459
a6e4672c5924732f9c4d509540f577a2d2115454
/new_dawn_server/management/commands/create_super_user.py
0fc41b80819dc830d42e81b2d48fa23d63f9955c
[]
no_license
new-dawn/new_dawn_server
78f9e9e4815c589414e02ebadd7d9b41b059c6d4
31c39553cd919b8f8d2e24329822f383e7203ce2
refs/heads/master
2022-12-18T19:29:56.407943
2019-08-07T03:05:40
2019-08-07T03:05:40
156,310,163
0
0
null
2022-12-08T01:28:21
2018-11-06T01:51:43
Python
UTF-8
Python
false
false
662
py
import os from django.contrib.auth.models import User from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): if 'SUPER_USER_NAME' in os.environ and 'SUPER_USER_EMAIL' in os.environ and 'SUPER_USER_PASSWORD' in os.environ: username = os.environ['SUPER_USER_NAME'] if not User.objects.filter(username=username).exists(): User.objects.create_superuser( username, os.environ['SUPER_USER_EMAIL'], os.environ['SUPER_USER_PASSWORD']) admin_user = User.objects.get(username=username) print("Super User Created: " + admin_user.username) print("Api-Key: " + admin_user.api_key.key)
[ "noreply@github.com" ]
new-dawn.noreply@github.com
2dc34c03a5e5fc786e8c488d98eae17ebcdbda9c
066a5d8c5f11dcd9183eebe8f808859a931d17fb
/polls/migrations/0001_initial.py
df878c22ab6c45fa24c43c4b1b7849b467d76d72
[]
no_license
huangxinkid/mysite
215b4ea787a7d683db3c5a4a869d83083b85eb92
be774fad11b5f5406b65673a17c9e2db2599e550
refs/heads/master
2022-08-31T13:16:19.164454
2021-02-21T14:25:10
2021-02-21T14:25:10
204,312,992
1
0
null
2022-08-23T18:24:27
2019-08-25T15:25:56
JavaScript
UTF-8
Python
false
false
1,165
py
# Generated by Django 2.0.1 on 2019-08-25 13:30 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Choice', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('choice_text', models.CharField(max_length=200)), ('votes', models.IntegerField(default=0)), ], ), migrations.CreateModel( name='Question', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('question_text', models.CharField(max_length=200)), ('pub_date', models.DateTimeField(verbose_name='date published')), ], ), migrations.AddField( model_name='choice', name='question', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question'), ), ]
[ "364296999@qq.com" ]
364296999@qq.com
dcdb1097b0de04146d7c8ec4355dd753d1332ac7
d1f38423b37020f64a32eda523fb77e0cde23a05
/Course_on_stepik/Python_on_stepik/python_bases_and_practice/part_1/week_2_practice_buffer.py
ae9208c801d32f0df059d2968ee980363d729f81
[]
no_license
zarkaltair/Data-Scientist
9f2c1234a4f1f014165d3389be9ab77c787c0226
ca318046caff51977efff0762fa8f4704f77433a
refs/heads/master
2021-06-12T08:08:40.787110
2021-04-19T17:55:10
2021-04-19T17:55:10
171,741,930
2
1
null
null
null
null
UTF-8
Python
false
false
3,155
py
''' Вам дается последовательность целых чисел и вам нужно ее обработать и вывести на экран сумму первой пятерки чисел из этой последовательности, затем сумму второй пятерки, и т. д. Но последовательность не дается вам сразу целиком. С течением времени к вам поступают её последовательные части. Например, сначала первые три элемента, потом следующие шесть, потом следующие два и т. д. Реализуйте класс Buffer, который будет накапливать в себе элементы последовательности и выводить сумму пятерок последовательных элементов по мере их накопления. Одним из требований к классу является то, что он не должен хранить в себе больше элементов, чем ему действительно необходимо, т. е. он не должен хранить элементы, которые уже вошли в пятерку, для которой была выведена сумма. Класс должен иметь следующий вид class Buffer: def __init__(self): # конструктор без аргументов      def add(self, *a): # добавить следующую часть последовательности def get_current_part(self): # вернуть сохраненные в текущий момент элементы последовательности в порядке, в котором они были # добавлены ''' class Buffer: def __init__(self): # конструктор без аргументов self.arr = [] def add(self, *a): # добавить следующую часть последовательности self.arr += a while len(self.arr) >= 5: s = sum(self.arr[:5]) print(s) self.arr = self.arr[5:] def get_current_part(self): # вернуть сохраненные в текущий момент элементы последовательности в порядке, в котором они были добавлены return self.arr buf = Buffer() buf.add(1, 2, 3) buf.get_current_part() # вернуть [1, 2, 3] buf.add(4, 5, 6) # print(15) – вывод суммы первой пятерки элементов buf.get_current_part() # вернуть [6] buf.add(7, 8, 9, 10) # print(40) – вывод суммы второй пятерки элементов buf.get_current_part() # вернуть [] buf.add(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) # print(5), print(5) – вывод сумм третьей и четвертой пятерки buf.get_current_part() # вернуть [1]
[ "zarkaltair@gmail.com" ]
zarkaltair@gmail.com
0302cfab8147b8ca85bfdca9e6fde5623b1387b2
b7c2de28db8bcfec43fcd537ce35e60f6fbc62fd
/portfolio/bin/python-config
11be30d2806749a68c0b5c1a7ef6ca564f10490b
[]
no_license
Kzone-m/MyPortfolio
b128f1b27f7d410488f6d5aa6af40206e58251c6
3ff0ceb37b6ef82180bc2bd2d0cc6e0fb72d0954
refs/heads/master
2021-06-20T12:20:27.523689
2017-05-22T07:57:04
2017-05-22T07:57:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,357
#!/Users/Kazune/PycharmProjects/portfolio/bin/python import sys import getopt import sysconfig valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 'ldflags', 'help'] if sys.version_info >= (3, 2): valid_opts.insert(-1, 'extension-suffix') valid_opts.append('abiflags') if sys.version_info >= (3, 3): valid_opts.append('configdir') def exit_with_usage(code=1): sys.stderr.write("Usage: {0} [{1}]\n".format( sys.argv[0], '|'.join('--'+opt for opt in valid_opts))) sys.exit(code) try: opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) except getopt.error: exit_with_usage() if not opts: exit_with_usage() pyver = sysconfig.get_config_var('VERSION') getvar = sysconfig.get_config_var opt_flags = [flag for (flag, val) in opts] if '--help' in opt_flags: exit_with_usage(code=0) for opt in opt_flags: if opt == '--prefix': print(sysconfig.get_config_var('prefix')) elif opt == '--exec-prefix': print(sysconfig.get_config_var('exec_prefix')) elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_path('include'), '-I' + sysconfig.get_path('platinclude')] if opt == '--cflags': flags.extend(getvar('CFLAGS').split()) print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): abiflags = getattr(sys, 'abiflags', '') libs = ['-lpython' + pyver + abiflags] libs += getvar('LIBS').split() libs += getvar('SYSLIBS').split() # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) if not getvar('PYTHONFRAMEWORK'): libs.extend(getvar('LINKFORSHARED').split()) print(' '.join(libs)) elif opt == '--extension-suffix': ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') if ext_suffix is None: ext_suffix = sysconfig.get_config_var('SO') print(ext_suffix) elif opt == '--abiflags': if not getattr(sys, 'abiflags', None): exit_with_usage() print(sys.abiflags) elif opt == '--configdir': print(sysconfig.get_config_var('LIBPL'))
[ "kazune.miyagi92@gmail.com" ]
kazune.miyagi92@gmail.com
4f6a0062ff2121f83fa9c6e0e97d63db101af486
3b4a5d2c62fe2c6f4222be7c117b1a5d423f81a8
/SYSTEM-B/main.py
ce3326a19454661ad9ff2fb5e97459eb4ef0489c
[]
no_license
PaulSiddharth/Statisctics
56f5d391d7a1507b4fb57389ea5fcc5d7ca29945
23404cbfe528b7b4054b0034d73ef73b9dc62f8d
refs/heads/master
2023-01-31T15:49:13.361493
2019-07-08T19:50:14
2019-07-08T19:50:14
195,870,792
0
0
null
2023-01-04T03:58:35
2019-07-08T19:03:41
Vue
UTF-8
Python
false
false
1,166
py
from flask import Flask from flask import request app = Flask(__name__) @app.route("/") def root(): """ Root router """ return 'Welcome to BH Reco!' @app.route("/generatenumber", methods=['GET']) def generatenumber(): """ Generate Random Number """ import random import json arr=[] # Genterating 6 random numbers for x in range(2): arr.append(random.randrange(2,11,2)) arr.append(random.randrange(1,11,2)) arr.append(random.randrange(2,11,2)) arr.append(random.randrange(2,11,2)) return json.dumps(arr) @app.route("/stats", methods=['GET']) def stats(): """ Generate Random Number """ import statistics import json arr=json.loads(request.args.get('entry')) # # x is odd count # # y is even count result = { "mean": statistics.mean(arr), "median": statistics.median(arr), "mode": statistics.variance(arr), "deviation": statistics.stdev(arr) } return json.dumps(result) if __name__ == "__main__": app.run()
[ "siddhartha.paul@sap.com" ]
siddhartha.paul@sap.com
cd69465ea34835feab0709e1ecd39a8742b02b67
c28198fbc8ee472586eaef7ce1356fea52e822dc
/confirmation_mail/mail_confirm/mail_confirm/settings.py
96694bf681bbec8c1a5e5dd84886ca6b7831494e
[]
no_license
CODEr-SaNjU/Confirm_mail
2ec7de76d21631e9d75118521af997b6409c674c
d405d5b88c6af7ecbc9cbded3ab2ee75e2e48732
refs/heads/master
2023-05-05T08:54:23.950937
2022-05-18T14:14:40
2022-05-18T14:14:40
234,261,880
0
0
null
2023-04-21T22:10:48
2020-01-16T07:34:41
Python
UTF-8
Python
false
false
3,378
py
""" Django settings for mail_confirm project. Generated by 'django-admin startproject' using Django 2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '#ec9^+0sn2y($%ol3tmug3r65ki6r=4+64y_l==f$ha&!zn=&$' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'register' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'mail_confirm.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,'register/templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'mail_confirm.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } #email_send EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'gmail id here' EMAIL_HOST_PASSWORD = 'gmail password' EMAIL_PORT = 587 # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/'
[ "sanju2help@gmail.com" ]
sanju2help@gmail.com
70bc84ae75d364f5e5d51b1a1aebb93a6249f0cb
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/4/ky2.py
71729497763cd3bd7a28d0c2fe334d924ec8eb4b
[]
no_license
G4te-Keep3r/HowdyHackers
46bfad63eafe5ac515da363e1c75fa6f4b9bca32
fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2
refs/heads/master
2020-08-01T12:08:10.782018
2016-11-13T20:45:50
2016-11-13T20:45:50
73,624,224
0
1
null
null
null
null
UTF-8
Python
false
false
486
py
import sys def printFunction(lineRemaining): if lineRemaining[0] == '"' and lineRemaining[-1] == '"': if len(lineRemaining) > 2: #data to print lineRemaining = lineRemaining[1:-1] print ' '.join(lineRemaining) else: print def main(fileName): with open(fileName) as f: for line in f: data = line.split() if data[0] == 'kY2': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
[ "juliettaylorswift@gmail.com" ]
juliettaylorswift@gmail.com
d352ea9e6b81a9572d3a7eada7b843cc47ffd773
31afebde0a0f52d14bdfeff55d6d2e3030bf7f62
/crawlers/common_nlp/pdf_to_text.py
28bf69b00b2e6e4861161ae02d28a868063e15f5
[ "Apache-2.0" ]
permissive
FabioAyresInsper/Pesquisas
fb8f4a6e3835c49e7dd2d033b5f1e05cfc2448ba
ebc4a45b9953ff9d91a7284bd579ad02cf818e2a
refs/heads/master
2020-03-17T22:11:42.741226
2018-05-29T12:23:11
2018-05-29T12:23:11
133,992,854
0
0
null
2018-05-18T18:53:39
2018-05-18T18:53:38
null
UTF-8
Python
false
false
1,425
py
from pdfminer.pdfparser import PDFParser from pdfminer.pdfdocument import PDFDocument from pdfminer.pdfpage import PDFPage from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from pdfminer.converter import PDFPageAggregator from pdfminer.layout import LAParams, LTTextBox, LTTextLine import PyPDF2 class pdf_to_text(): """Converts pdf to text with pdfminer""" def __init__(self): pass def convert_pdfminer(self, fname): fp = open(fname, 'rb') parser = PDFParser(fp) doc = PDFDocument(parser) rsrcmgr = PDFResourceManager() laparams = LAParams() device = PDFPageAggregator(rsrcmgr, laparams=laparams) interpreter = PDFPageInterpreter(rsrcmgr, device) text = '' for page in PDFPage.create_pages(doc): interpreter.process_page(page) layout = device.get_result() for lt_obj in layout: if isinstance(lt_obj, LTTextBox) or isinstance(lt_obj, LTTextLine): text += lt_obj.get_text() return text def convert_PyPDF2(self,fname): pdfFileObj = open(fname,'rb') pdfReader = PyPDF2.PdfFileReader(pdfFileObj) text = '' for i in range(pdfReader.numPages): pageObj = pdfReader.getPage(i) text += pageObj.extractText() + '\n' return text if __name__ == '__main__': pass
[ "danilopcarlotti@gmail.com" ]
danilopcarlotti@gmail.com
7d8f0504b3a317a137e02df5fcdf426b4e32f534
f63db957cb63b3a37642d138d3092f8f897d6a53
/roundup_getnodes/roundup/init.py
7ecba91ef516ad7d261a828aa6e6dfd9f8dd374b
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "ZPL-2.1", "ZPL-2.0" ]
permissive
fillarikanava/old-fillarikanava
c6fd819f95e675e6eddc674e71528c798b391967
8dbb89ea34c2aa98450e403ca2d7f17179edff8d
refs/heads/master
2021-01-13T02:30:01.501771
2013-10-03T16:26:13
2013-10-03T16:26:13
13,201,013
0
1
null
null
null
null
UTF-8
Python
false
false
6,395
py
# # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) # This module is free software, and you may redistribute it and/or modify # under the same terms as Python, so long as this copyright message and # disclaimer are retained in their original form. # # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # # $Id: init.py,v 1.36 2005-12-03 11:22:50 a1s Exp $ """Init (create) a roundup instance. """ __docformat__ = 'restructuredtext' import os, errno, rfc822 from roundup import install_util, password from roundup.configuration import CoreConfig from roundup.i18n import _ def copytree(src, dst, symlinks=0): """Recursively copy a directory tree using copyDigestedFile(). The destination directory is allowed to exist. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. This was copied from shutil.py in std lib. """ # Prevent 'hidden' files (those starting with '.') from being considered. names = [f for f in os.listdir(src) if not f.startswith('.')] try: os.mkdir(dst) except OSError, error: if error.errno != errno.EEXIST: raise for name in names: srcname = os.path.join(src, name) dstname = os.path.join(dst, name) if symlinks and os.path.islink(srcname): linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): copytree(srcname, dstname, symlinks) else: install_util.copyDigestedFile(srcname, dstname) def install(instance_home, template, settings={}): '''Install an instance using the named template and backend. 'instance_home' the directory to place the instance data in 'template' the directory holding the template to use in creating the instance data 'settings' config.ini setting overrides (dictionary) The instance_home directory will be created using the files found in the named template (roundup.templates.<name>). A usual instance_home contains: config.ini tracker configuration file schema.py database schema definition initial_data.py database initialization script, used to populate the database with 'roundup-admin init' command interfaces.py (optional, not installed from standard templates) defines the CGI Client and mail gateway MailGW classes that are used by roundup.cgi, roundup-server and roundup-mailgw. db/ the actual database that stores the instance's data html/ the html templates that are used by the CGI Client detectors/ the auditor and reactor modules for this instance extensions/ code extensions to Roundup ''' # At the moment, it's just a copy copytree(template, instance_home) # rename the tempate in the TEMPLATE-INFO.txt file ti = loadTemplateInfo(instance_home) ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1] saveTemplateInfo(instance_home, ti) # if there is no config.ini or old-style config.py # installed from the template, write default config text config_ini_file = os.path.join(instance_home, CoreConfig.INI_FILE) if not os.path.isfile(config_ini_file): config = CoreConfig(settings=settings) config.save(config_ini_file) def listTemplates(dir): ''' List all the Roundup template directories in a given directory. Find all the dirs that contain a TEMPLATE-INFO.txt and parse it. Return a list of dicts of info about the templates. ''' ret = {} for idir in os.listdir(dir): idir = os.path.join(dir, idir) ti = loadTemplateInfo(idir) if ti: ret[ti['name']] = ti return ret def loadTemplateInfo(dir): ''' Attempt to load a Roundup template from the indicated directory. Return None if there's no template, otherwise a template info dictionary. ''' ti = os.path.join(dir, 'TEMPLATE-INFO.txt') if not os.path.exists(ti): return None if os.path.exists(os.path.join(dir, 'config.py')): print _("WARNING: directory '%s'\n" "\tcontains old-style template - ignored" ) % os.path.abspath(dir) return None # load up the template's information f = open(ti) try: m = rfc822.Message(open(ti)) ti = {} ti['name'] = m['name'] ti['description'] = m['description'] ti['intended-for'] = m['intended-for'] ti['path'] = dir finally: f.close() return ti def writeHeader(name, value): ''' Write an rfc822-compatible header line, making it wrap reasonably ''' out = [name.capitalize() + ':'] n = len(out[0]) for word in value.split(): if len(word) + n > 74: out.append('\n') n = 0 out.append(' ' + word) n += len(out[-1]) return ''.join(out) + '\n' def saveTemplateInfo(dir, info): ''' Save the template info (dict of values) to the TEMPLATE-INFO.txt file in the indicated directory. ''' ti = os.path.join(dir, 'TEMPLATE-INFO.txt') f = open(ti, 'w') try: for name in 'name description intended-for path'.split(): f.write(writeHeader(name, info[name])) finally: f.close() def write_select_db(instance_home, backend): ''' Write the file that selects the backend for the tracker ''' dbdir = os.path.join(instance_home, 'db') if not os.path.exists(dbdir): os.makedirs(dbdir) f = open(os.path.join(dbdir, 'backend_name'), 'w') f.write(backend+'\n') f.close() # vim: set filetype=python sts=4 sw=4 et si :
[ "rkarhila@iki.fi" ]
rkarhila@iki.fi
a26bd92e4e80fe22862e8021588404a0bd9b2554
28c614942558229bb9adca33070331b04d454015
/py/pantone-p-color-bridge-coated.py
b32073b70b4e7854182ebfab9d6ddb13602b0a57
[]
no_license
qdv/Colorly
95827b077b888251dea3a2ed58e8a37e98837409
6891a2d550a66e374c5da441b452256abccaffad
refs/heads/gh-pages
2021-05-28T02:57:53.409957
2014-11-12T03:00:26
2014-11-12T03:00:26
100,415,084
1
0
null
2017-08-15T20:05:44
2017-08-15T20:05:44
null
UTF-8
Python
false
false
106,974
py
PALETTE = [ { "name": "PANTONE Process Yellow CP", "label": "process-yellow", "hex": "#ffed00" }, { "name": "PANTONE Process Magenta CP", "label": "process-magenta", "hex": "#e3007d" }, { "name": "PANTONE Process Cyan CP", "label": "process-cyan", "hex": "#00a0e1" }, { "name": "PANTONE Process Black CP", "label": "process-black", "hex": "#2d2c2b" }, { "name": "PANTONE 100 CP", "label": "100", "hex": "#fff58d" }, { "name": "PANTONE 101 CP", "label": "101", "hex": "#fff26d" }, { "name": "PANTONE 102 CP", "label": "102", "hex": "#ffed00" }, { "name": "PANTONE Yellow CP", "label": "yellow", "hex": "#ffeb00" }, { "name": "PANTONE 103 CP", "label": "103", "hex": "#ddc600" }, { "name": "PANTONE 104 CP", "label": "104", "hex": "#c1a80d" }, { "name": "PANTONE 105 CP", "label": "105", "hex": "#988633" }, { "name": "PANTONE 7401 CP", "label": "7401", "hex": "#fff4cb" }, { "name": "PANTONE 7402 CP", "label": "7402", "hex": "#feeea5" }, { "name": "PANTONE 7403 CP", "label": "7403", "hex": "#fbde83" }, { "name": "PANTONE 7404 CP", "label": "7404", "hex": "#ffe234" }, { "name": "PANTONE 7405 CP", "label": "7405", "hex": "#ffd800" }, { "name": "PANTONE 7406 CP", "label": "7406", "hex": "#fcc900" }, { "name": "PANTONE 7407 CP", "label": "7407", "hex": "#d9a04a" }, { "name": "PANTONE 106 CP", "label": "106", "hex": "#fff159" }, { "name": "PANTONE 107 CP", "label": "107", "hex": "#ffee00" }, { "name": "PANTONE 108 CP", "label": "108", "hex": "#ffe500" }, { "name": "PANTONE 109 CP", "label": "109", "hex": "#ffde00" }, { "name": "PANTONE 110 CP", "label": "110", "hex": "#edbc00" }, { "name": "PANTONE 111 CP", "label": "111", "hex": "#be9d15" }, { "name": "PANTONE 112 CP", "label": "112", "hex": "#a58c1c" }, { "name": "PANTONE 113 CP", "label": "113", "hex": "#ffec3d" }, { "name": "PANTONE 114 CP", "label": "114", "hex": "#ffe82e" }, { "name": "PANTONE 115 CP", "label": "115", "hex": "#ffe52f" }, { "name": "PANTONE 116 CP", "label": "116", "hex": "#ffd600" }, { "name": "PANTONE 117 CP", "label": "117", "hex": "#dcab0b" }, { "name": "PANTONE 118 CP", "label": "118", "hex": "#b9911a" }, { "name": "PANTONE 119 CP", "label": "119", "hex": "#907d21" }, { "name": "PANTONE 127 CP", "label": "127", "hex": "#ffed7d" }, { "name": "PANTONE 128 CP", "label": "128", "hex": "#ffe659" }, { "name": "PANTONE 129 CP", "label": "129", "hex": "#ffde4f" }, { "name": "PANTONE 130 CP", "label": "130", "hex": "#fbb600" }, { "name": "PANTONE 131 CP", "label": "131", "hex": "#e29d14" }, { "name": "PANTONE 132 CP", "label": "132", "hex": "#b0811f" }, { "name": "PANTONE 133 CP", "label": "133", "hex": "#786024" }, { "name": "PANTONE 1205 CP", "label": "1205", "hex": "#fff2ab" }, { "name": "PANTONE 1215 CP", "label": "1215", "hex": "#ffec93" }, { "name": "PANTONE 1225 CP", "label": "1225", "hex": "#ffd14e" }, { "name": "PANTONE 1235 CP", "label": "1235", "hex": "#fcb909" }, { "name": "PANTONE 1245 CP", "label": "1245", "hex": "#cf981c" }, { "name": "PANTONE 1255 CP", "label": "1255", "hex": "#b48722" }, { "name": "PANTONE 1265 CP", "label": "1265", "hex": "#93712a" }, { "name": "PANTONE 120 CP", "label": "120", "hex": "#ffeb77" }, { "name": "PANTONE 121 CP", "label": "121", "hex": "#ffe566" }, { "name": "PANTONE 122 CP", "label": "122", "hex": "#ffde4a" }, { "name": "PANTONE 123 CP", "label": "123", "hex": "#ffcf2d" }, { "name": "PANTONE 124 CP", "label": "124", "hex": "#fcba00" }, { "name": "PANTONE 125 CP", "label": "125", "hex": "#c59418" }, { "name": "PANTONE 126 CP", "label": "126", "hex": "#a8841e" }, { "name": "PANTONE 7548 CP", "label": "7548", "hex": "#ffd900" }, { "name": "PANTONE 7549 CP", "label": "7549", "hex": "#fcc600" }, { "name": "PANTONE 7550 CP", "label": "7550", "hex": "#e3a418" }, { "name": "PANTONE 7551 CP", "label": "7551", "hex": "#bb8225" }, { "name": "PANTONE 7552 CP", "label": "7552", "hex": "#785b24" }, { "name": "PANTONE 7553 CP", "label": "7553", "hex": "#5c4932" }, { "name": "PANTONE 7554 CP", "label": "7554", "hex": "#463a2e" }, { "name": "PANTONE 7555 CP", "label": "7555", "hex": "#e7af10" }, { "name": "PANTONE 7556 CP", "label": "7556", "hex": "#cc971d" }, { "name": "PANTONE 7557 CP", "label": "7557", "hex": "#a7831f" }, { "name": "PANTONE 7558 CP", "label": "7558", "hex": "#9c782a" }, { "name": "PANTONE 7559 CP", "label": "7559", "hex": "#926e2a" }, { "name": "PANTONE 7560 CP", "label": "7560", "hex": "#7f6429" }, { "name": "PANTONE 7561 CP", "label": "7561", "hex": "#6d572c" }, { "name": "PANTONE 134 CP", "label": "134", "hex": "#ffe07f" }, { "name": "PANTONE 135 CP", "label": "135", "hex": "#ffcd55" }, { "name": "PANTONE 136 CP", "label": "136", "hex": "#fdc037" }, { "name": "PANTONE 137 CP", "label": "137", "hex": "#f8a60e" }, { "name": "PANTONE 138 CP", "label": "138", "hex": "#f3901b" }, { "name": "PANTONE 139 CP", "label": "139", "hex": "#bd7a21" }, { "name": "PANTONE 140 CP", "label": "140", "hex": "#7e5a25" }, { "name": "PANTONE 1345 CP", "label": "1345", "hex": "#ffda95" }, { "name": "PANTONE 1355 CP", "label": "1355", "hex": "#fecf7b" }, { "name": "PANTONE 1365 CP", "label": "1365", "hex": "#fab653" }, { "name": "PANTONE 1375 CP", "label": "1375", "hex": "#f69f29" }, { "name": "PANTONE 1385 CP", "label": "1385", "hex": "#e98520" }, { "name": "PANTONE 1395 CP", "label": "1395", "hex": "#a16424" }, { "name": "PANTONE 1405 CP", "label": "1405", "hex": "#734f25" }, { "name": "PANTONE 141 CP", "label": "141", "hex": "#ffd871" }, { "name": "PANTONE 142 CP", "label": "142", "hex": "#fec850" }, { "name": "PANTONE 143 CP", "label": "143", "hex": "#fbb838" }, { "name": "PANTONE 144 CP", "label": "144", "hex": "#f4921a" }, { "name": "PANTONE 145 CP", "label": "145", "hex": "#df851f" }, { "name": "PANTONE 146 CP", "label": "146", "hex": "#ac7022" }, { "name": "PANTONE 147 CP", "label": "147", "hex": "#79602e" }, { "name": "PANTONE 7408 CP", "label": "7408", "hex": "#fcbc00" }, { "name": "PANTONE 7409 CP", "label": "7409", "hex": "#fcb900" }, { "name": "PANTONE 7410 CP", "label": "7410", "hex": "#f7ab74" }, { "name": "PANTONE 7411 CP", "label": "7411", "hex": "#f3a654" }, { "name": "PANTONE 7412 CP", "label": "7412", "hex": "#dc7b2a" }, { "name": "PANTONE 7413 CP", "label": "7413", "hex": "#e77c26" }, { "name": "PANTONE 7414 CP", "label": "7414", "hex": "#c06326" }, { "name": "PANTONE 7562 CP", "label": "7562", "hex": "#cca360" }, { "name": "PANTONE 7563 CP", "label": "7563", "hex": "#ecae37" }, { "name": "PANTONE 7564 CP", "label": "7564", "hex": "#ef9a16" }, { "name": "PANTONE 7565 CP", "label": "7565", "hex": "#df8423" }, { "name": "PANTONE 7566 CP", "label": "7566", "hex": "#bb5f29" }, { "name": "PANTONE 7567 CP", "label": "7567", "hex": "#7f4926" }, { "name": "PANTONE 7568 CP", "label": "7568", "hex": "#6e4225" }, { "name": "PANTONE 7569 CP", "label": "7569", "hex": "#eb9816" }, { "name": "PANTONE 7570 CP", "label": "7570", "hex": "#e28f21" }, { "name": "PANTONE 7571 CP", "label": "7571", "hex": "#ce8325" }, { "name": "PANTONE 7572 CP", "label": "7572", "hex": "#b9742c" }, { "name": "PANTONE 7573 CP", "label": "7573", "hex": "#aa6a33" }, { "name": "PANTONE 7574 CP", "label": "7574", "hex": "#a2662f" }, { "name": "PANTONE 7575 CP", "label": "7575", "hex": "#81562a" }, { "name": "PANTONE 712 CP", "label": "712", "hex": "#fcd8b9" }, { "name": "PANTONE 713 CP", "label": "713", "hex": "#fac9a2" }, { "name": "PANTONE 714 CP", "label": "714", "hex": "#f7ae75" }, { "name": "PANTONE 715 CP", "label": "715", "hex": "#f28d3a" }, { "name": "PANTONE 716 CP", "label": "716", "hex": "#f07d24" }, { "name": "PANTONE 717 CP", "label": "717", "hex": "#ed6f24" }, { "name": "PANTONE 718 CP", "label": "718", "hex": "#dd5d26" }, { "name": "PANTONE 148 CP", "label": "148", "hex": "#fedba3" }, { "name": "PANTONE 149 CP", "label": "149", "hex": "#fccd8e" }, { "name": "PANTONE 150 CP", "label": "150", "hex": "#f7a94e" }, { "name": "PANTONE 151 CP", "label": "151", "hex": "#f07f21" }, { "name": "PANTONE 152 CP", "label": "152", "hex": "#ee7323" }, { "name": "PANTONE 153 CP", "label": "153", "hex": "#c96925" }, { "name": "PANTONE 154 CP", "label": "154", "hex": "#9c5426" }, { "name": "PANTONE 155 CP", "label": "155", "hex": "#ffe5b8" }, { "name": "PANTONE 156 CP", "label": "156", "hex": "#fdcf93" }, { "name": "PANTONE 157 CP", "label": "157", "hex": "#f7a856" }, { "name": "PANTONE 158 CP", "label": "158", "hex": "#ef7c2c" }, { "name": "PANTONE 159 CP", "label": "159", "hex": "#de6126" }, { "name": "PANTONE 160 CP", "label": "160", "hex": "#ae5426" }, { "name": "PANTONE 161 CP", "label": "161", "hex": "#633d24" }, { "name": "PANTONE 1485 CP", "label": "1485", "hex": "#f9b97a" }, { "name": "PANTONE 1495 CP", "label": "1495", "hex": "#f69f4d" }, { "name": "PANTONE 1505 CP", "label": "1505", "hex": "#f28935" }, { "name": "PANTONE Orange 021 CP", "label": "orange-021", "hex": "#ee7523" }, { "name": "PANTONE 1525 CP", "label": "1525", "hex": "#d85727" }, { "name": "PANTONE 1535 CP", "label": "1535", "hex": "#964727" }, { "name": "PANTONE 1545 CP", "label": "1545", "hex": "#613825" }, { "name": "PANTONE 1555 CP", "label": "1555", "hex": "#fbccaa" }, { "name": "PANTONE 1565 CP", "label": "1565", "hex": "#f7b185" }, { "name": "PANTONE 1575 CP", "label": "1575", "hex": "#f4954e" }, { "name": "PANTONE 1585 CP", "label": "1585", "hex": "#f07d28" }, { "name": "PANTONE 1595 CP", "label": "1595", "hex": "#e76625" }, { "name": "PANTONE 1605 CP", "label": "1605", "hex": "#ac5326" }, { "name": "PANTONE 1615 CP", "label": "1615", "hex": "#904926" }, { "name": "PANTONE 162 CP", "label": "162", "hex": "#fbcdad" }, { "name": "PANTONE 163 CP", "label": "163", "hex": "#f5a77f" }, { "name": "PANTONE 164 CP", "label": "164", "hex": "#f18446" }, { "name": "PANTONE 165 CP", "label": "165", "hex": "#ec6925" }, { "name": "PANTONE 166 CP", "label": "166", "hex": "#ea5d27" }, { "name": "PANTONE 167 CP", "label": "167", "hex": "#c95328" }, { "name": "PANTONE 168 CP", "label": "168", "hex": "#773a26" }, { "name": "PANTONE 7576 CP", "label": "7576", "hex": "#ea9550" }, { "name": "PANTONE 7577 CP", "label": "7577", "hex": "#ef8d5b" }, { "name": "PANTONE 7578 CP", "label": "7578", "hex": "#ee7024" }, { "name": "PANTONE 7579 CP", "label": "7579", "hex": "#eb6126" }, { "name": "PANTONE 7580 CP", "label": "7580", "hex": "#d0542b" }, { "name": "PANTONE 7581 CP", "label": "7581", "hex": "#834b38" }, { "name": "PANTONE 7582 CP", "label": "7582", "hex": "#674935" }, { "name": "PANTONE 1625 CP", "label": "1625", "hex": "#f6ae93" }, { "name": "PANTONE 1635 CP", "label": "1635", "hex": "#f39875" }, { "name": "PANTONE 1645 CP", "label": "1645", "hex": "#ef7b4d" }, { "name": "PANTONE 1655 CP", "label": "1655", "hex": "#ec6429" }, { "name": "PANTONE 1665 CP", "label": "1665", "hex": "#ea5727" }, { "name": "PANTONE 1675 CP", "label": "1675", "hex": "#b34428" }, { "name": "PANTONE 1685 CP", "label": "1685", "hex": "#8b3d27" }, { "name": "PANTONE 169 CP", "label": "169", "hex": "#f9c5b7" }, { "name": "PANTONE 170 CP", "label": "170", "hex": "#f49f80" }, { "name": "PANTONE 171 CP", "label": "171", "hex": "#f07f52" }, { "name": "PANTONE 172 CP", "label": "172", "hex": "#ec6439" }, { "name": "PANTONE 173 CP", "label": "173", "hex": "#e54f30" }, { "name": "PANTONE 174 CP", "label": "174", "hex": "#a13c28" }, { "name": "PANTONE 175 CP", "label": "175", "hex": "#793c32" }, { "name": "PANTONE 7583 CP", "label": "7583", "hex": "#d76428" }, { "name": "PANTONE 7584 CP", "label": "7584", "hex": "#ce5f25" }, { "name": "PANTONE 7585 CP", "label": "7585", "hex": "#c36132" }, { "name": "PANTONE 7586 CP", "label": "7586", "hex": "#a3522f" }, { "name": "PANTONE 7587 CP", "label": "7587", "hex": "#974c2e" }, { "name": "PANTONE 7588 CP", "label": "7588", "hex": "#7a4f38" }, { "name": "PANTONE 7589 CP", "label": "7589", "hex": "#553932" }, { "name": "PANTONE 7590 CP", "label": "7590", "hex": "#e6c3ad" }, { "name": "PANTONE 7591 CP", "label": "7591", "hex": "#d6895d" }, { "name": "PANTONE 7592 CP", "label": "7592", "hex": "#c35e37" }, { "name": "PANTONE 7593 CP", "label": "7593", "hex": "#a4452e" }, { "name": "PANTONE 7594 CP", "label": "7594", "hex": "#824837" }, { "name": "PANTONE 7595 CP", "label": "7595", "hex": "#784c37" }, { "name": "PANTONE 7596 CP", "label": "7596", "hex": "#533227" }, { "name": "PANTONE 7597 CP", "label": "7597", "hex": "#e14729" }, { "name": "PANTONE 7598 CP", "label": "7598", "hex": "#d64528" }, { "name": "PANTONE 7599 CP", "label": "7599", "hex": "#c5432a" }, { "name": "PANTONE 7600 CP", "label": "7600", "hex": "#8a3f2f" }, { "name": "PANTONE 7601 CP", "label": "7601", "hex": "#853c27" }, { "name": "PANTONE 7602 CP", "label": "7602", "hex": "#764428" }, { "name": "PANTONE 7603 CP", "label": "7603", "hex": "#603b25" }, { "name": "PANTONE 7604 CP", "label": "7604", "hex": "#f6ebe9" }, { "name": "PANTONE 7605 CP", "label": "7605", "hex": "#f3d1cc" }, { "name": "PANTONE 7606 CP", "label": "7606", "hex": "#eba8a2" }, { "name": "PANTONE 7607 CP", "label": "7607", "hex": "#d77a6d" }, { "name": "PANTONE 7608 CP", "label": "7608", "hex": "#b44e3f" }, { "name": "PANTONE 7609 CP", "label": "7609", "hex": "#8b3c34" }, { "name": "PANTONE 7610 CP", "label": "7610", "hex": "#6b3733" }, { "name": "PANTONE 7611 CP", "label": "7611", "hex": "#f1d3c9" }, { "name": "PANTONE 7612 CP", "label": "7612", "hex": "#deac9c" }, { "name": "PANTONE 7613 CP", "label": "7613", "hex": "#cf9886" }, { "name": "PANTONE 7614 CP", "label": "7614", "hex": "#b58c7e" }, { "name": "PANTONE 7615 CP", "label": "7615", "hex": "#886861" }, { "name": "PANTONE 7616 CP", "label": "7616", "hex": "#795754" }, { "name": "PANTONE 7617 CP", "label": "7617", "hex": "#5d3f3d" }, { "name": "PANTONE 7520 CP", "label": "7520", "hex": "#f8cdc3" }, { "name": "PANTONE 7521 CP", "label": "7521", "hex": "#d8ad9d" }, { "name": "PANTONE 7522 CP", "label": "7522", "hex": "#c87062" }, { "name": "PANTONE 7523 CP", "label": "7523", "hex": "#b86160" }, { "name": "PANTONE 7524 CP", "label": "7524", "hex": "#b04c4b" }, { "name": "PANTONE 7525 CP", "label": "7525", "hex": "#a76a52" }, { "name": "PANTONE 7526 CP", "label": "7526", "hex": "#903c27" }, { "name": "PANTONE 489 CP", "label": "489", "hex": "#fcd9c9" }, { "name": "PANTONE 488 CP", "label": "488", "hex": "#f8c4b7" }, { "name": "PANTONE 487 CP", "label": "487", "hex": "#f5aa95" }, { "name": "PANTONE 486 CP", "label": "486", "hex": "#f2907a" }, { "name": "PANTONE 485 CP", "label": "485", "hex": "#e52f2a" }, { "name": "PANTONE 484 CP", "label": "484", "hex": "#a53429" }, { "name": "PANTONE 483 CP", "label": "483", "hex": "#62352c" }, { "name": "PANTONE 176 CP", "label": "176", "hex": "#f7bdbf" }, { "name": "PANTONE 177 CP", "label": "177", "hex": "#f2928d" }, { "name": "PANTONE 178 CP", "label": "178", "hex": "#ed6c62" }, { "name": "PANTONE Warm Red CP", "label": "warm-red", "hex": "#e94d40" }, { "name": "PANTONE 179 CP", "label": "179", "hex": "#e74439" }, { "name": "PANTONE 180 CP", "label": "180", "hex": "#cd3936" }, { "name": "PANTONE 181 CP", "label": "181", "hex": "#7e312d" }, { "name": "PANTONE 1765 CP", "label": "1765", "hex": "#f5afb7" }, { "name": "PANTONE 1775 CP", "label": "1775", "hex": "#f39fa8" }, { "name": "PANTONE 1785 CP", "label": "1785", "hex": "#eb5e62" }, { "name": "PANTONE 1788 CP", "label": "1788", "hex": "#e7423c" }, { "name": "PANTONE 1795 CP", "label": "1795", "hex": "#e12b30" }, { "name": "PANTONE 1805 CP", "label": "1805", "hex": "#b92d38" }, { "name": "PANTONE 1815 CP", "label": "1815", "hex": "#7c2c2c" }, { "name": "PANTONE 1767 CP", "label": "1767", "hex": "#f7c2cd" }, { "name": "PANTONE 1777 CP", "label": "1777", "hex": "#ee788b" }, { "name": "PANTONE 1787 CP", "label": "1787", "hex": "#e9505f" }, { "name": "PANTONE Red 032 CP", "label": "red-032", "hex": "#e84751" }, { "name": "PANTONE 1797 CP", "label": "1797", "hex": "#d62a36" }, { "name": "PANTONE 1807 CP", "label": "1807", "hex": "#a3323b" }, { "name": "PANTONE 1817 CP", "label": "1817", "hex": "#5b3032" }, { "name": "PANTONE 7618 CP", "label": "7618", "hex": "#dc7852" }, { "name": "PANTONE 7619 CP", "label": "7619", "hex": "#d55338" }, { "name": "PANTONE 7620 CP", "label": "7620", "hex": "#b52f2d" }, { "name": "PANTONE 7621 CP", "label": "7621", "hex": "#b0282e" }, { "name": "PANTONE 7622 CP", "label": "7622", "hex": "#982b2d" }, { "name": "PANTONE 7623 CP", "label": "7623", "hex": "#8a2c2c" }, { "name": "PANTONE 7624 CP", "label": "7624", "hex": "#7e2b2a" }, { "name": "PANTONE 7625 CP", "label": "7625", "hex": "#e95040" }, { "name": "PANTONE 7626 CP", "label": "7626", "hex": "#e2352f" }, { "name": "PANTONE 7627 CP", "label": "7627", "hex": "#ba3232" }, { "name": "PANTONE 7628 CP", "label": "7628", "hex": "#a53236" }, { "name": "PANTONE 7629 CP", "label": "7629", "hex": "#6c3231" }, { "name": "PANTONE 7630 CP", "label": "7630", "hex": "#5f312b" }, { "name": "PANTONE 7631 CP", "label": "7631", "hex": "#583035" }, { "name": "PANTONE 7415 CP", "label": "7415", "hex": "#f7c8b8" }, { "name": "PANTONE 7416 CP", "label": "7416", "hex": "#ec6750" }, { "name": "PANTONE 7417 CP", "label": "7417", "hex": "#e74d3a" }, { "name": "PANTONE 7418 CP", "label": "7418", "hex": "#d54c5a" }, { "name": "PANTONE 7419 CP", "label": "7419", "hex": "#b35060" }, { "name": "PANTONE 7420 CP", "label": "7420", "hex": "#a32343" }, { "name": "PANTONE 7421 CP", "label": "7421", "hex": "#682535" }, { "name": "PANTONE 182 CP", "label": "182", "hex": "#f8c6d2" }, { "name": "PANTONE 183 CP", "label": "183", "hex": "#f3a0b0" }, { "name": "PANTONE 184 CP", "label": "184", "hex": "#ec667f" }, { "name": "PANTONE 185 CP", "label": "185", "hex": "#e6343e" }, { "name": "PANTONE 186 CP", "label": "186", "hex": "#d71e36" }, { "name": "PANTONE 187 CP", "label": "187", "hex": "#b02434" }, { "name": "PANTONE 188 CP", "label": "188", "hex": "#762732" }, { "name": "PANTONE 196 CP", "label": "196", "hex": "#fad5de" }, { "name": "PANTONE 197 CP", "label": "197", "hex": "#f4a7ba" }, { "name": "PANTONE 198 CP", "label": "198", "hex": "#e95071" }, { "name": "PANTONE 199 CP", "label": "199", "hex": "#e41941" }, { "name": "PANTONE 200 CP", "label": "200", "hex": "#cb1f40" }, { "name": "PANTONE 201 CP", "label": "201", "hex": "#a6243a" }, { "name": "PANTONE 202 CP", "label": "202", "hex": "#8b2636" }, { "name": "PANTONE 189 CP", "label": "189", "hex": "#f5b6c6" }, { "name": "PANTONE 190 CP", "label": "190", "hex": "#f190a5" }, { "name": "PANTONE 191 CP", "label": "191", "hex": "#ea5875" }, { "name": "PANTONE 192 CP", "label": "192", "hex": "#e6304c" }, { "name": "PANTONE 193 CP", "label": "193", "hex": "#cf2147" }, { "name": "PANTONE 194 CP", "label": "194", "hex": "#9e2440" }, { "name": "PANTONE 195 CP", "label": "195", "hex": "#7a313e" }, { "name": "PANTONE 1895 CP", "label": "1895", "hex": "#f7c9dc" }, { "name": "PANTONE 1905 CP", "label": "1905", "hex": "#f3a5bd" }, { "name": "PANTONE 1915 CP", "label": "1915", "hex": "#eb6189" }, { "name": "PANTONE 1925 CP", "label": "1925", "hex": "#e52457" }, { "name": "PANTONE 1935 CP", "label": "1935", "hex": "#d9184e" }, { "name": "PANTONE 1945 CP", "label": "1945", "hex": "#af2144" }, { "name": "PANTONE 1955 CP", "label": "1955", "hex": "#93243d" }, { "name": "PANTONE 705 CP", "label": "705", "hex": "#fdecef" }, { "name": "PANTONE 706 CP", "label": "706", "hex": "#fad5dc" }, { "name": "PANTONE 707 CP", "label": "707", "hex": "#f6bccc" }, { "name": "PANTONE 708 CP", "label": "708", "hex": "#f197ab" }, { "name": "PANTONE 709 CP", "label": "709", "hex": "#ed7087" }, { "name": "PANTONE 710 CP", "label": "710", "hex": "#e94b65" }, { "name": "PANTONE 711 CP", "label": "711", "hex": "#e52740" }, { "name": "PANTONE 698 CP", "label": "698", "hex": "#fbe3e8" }, { "name": "PANTONE 699 CP", "label": "699", "hex": "#f8cdda" }, { "name": "PANTONE 700 CP", "label": "700", "hex": "#f5b4c7" }, { "name": "PANTONE 701 CP", "label": "701", "hex": "#f08ba8" }, { "name": "PANTONE 702 CP", "label": "702", "hex": "#e1597a" }, { "name": "PANTONE 703 CP", "label": "703", "hex": "#c43750" }, { "name": "PANTONE 704 CP", "label": "704", "hex": "#a72b37" }, { "name": "PANTONE 203 CP", "label": "203", "hex": "#f6bbd3" }, { "name": "PANTONE 204 CP", "label": "204", "hex": "#f08ab0" }, { "name": "PANTONE 205 CP", "label": "205", "hex": "#e94c83" }, { "name": "PANTONE 206 CP", "label": "206", "hex": "#e41355" }, { "name": "PANTONE 207 CP", "label": "207", "hex": "#b91f4c" }, { "name": "PANTONE 208 CP", "label": "208", "hex": "#8b2345" }, { "name": "PANTONE 209 CP", "label": "209", "hex": "#74283d" }, { "name": "PANTONE 210 CP", "label": "210", "hex": "#f3aac6" }, { "name": "PANTONE 211 CP", "label": "211", "hex": "#ef84ac" }, { "name": "PANTONE 212 CP", "label": "212", "hex": "#ea5992" }, { "name": "PANTONE 213 CP", "label": "213", "hex": "#e63078" }, { "name": "PANTONE 214 CP", "label": "214", "hex": "#dd0868" }, { "name": "PANTONE 215 CP", "label": "215", "hex": "#b51a5a" }, { "name": "PANTONE 216 CP", "label": "216", "hex": "#832849" }, { "name": "PANTONE 7422 CP", "label": "7422", "hex": "#fbe3ea" }, { "name": "PANTONE 7423 CP", "label": "7423", "hex": "#ec6692" }, { "name": "PANTONE 7424 CP", "label": "7424", "hex": "#e73782" }, { "name": "PANTONE 7425 CP", "label": "7425", "hex": "#c82760" }, { "name": "PANTONE 7426 CP", "label": "7426", "hex": "#b9224f" }, { "name": "PANTONE 7427 CP", "label": "7427", "hex": "#a42539" }, { "name": "PANTONE 7428 CP", "label": "7428", "hex": "#6e283d" }, { "name": "PANTONE 7632 CP", "label": "7632", "hex": "#efe2e4" }, { "name": "PANTONE 7633 CP", "label": "7633", "hex": "#d7b4bb" }, { "name": "PANTONE 7634 CP", "label": "7634", "hex": "#d6708f" }, { "name": "PANTONE 7635 CP", "label": "7635", "hex": "#da386f" }, { "name": "PANTONE 7636 CP", "label": "7636", "hex": "#d01853" }, { "name": "PANTONE 7637 CP", "label": "7637", "hex": "#9a2e48" }, { "name": "PANTONE 7638 CP", "label": "7638", "hex": "#8e3048" }, { "name": "PANTONE 217 CP", "label": "217", "hex": "#f5c4dc" }, { "name": "PANTONE 218 CP", "label": "218", "hex": "#eb7faf" }, { "name": "PANTONE 219 CP", "label": "219", "hex": "#e42e83" }, { "name": "PANTONE Rubine Red CP", "label": "rubine-red", "hex": "#df066a" }, { "name": "PANTONE 220 CP", "label": "220", "hex": "#b61a5a" }, { "name": "PANTONE 221 CP", "label": "221", "hex": "#9c1f50" }, { "name": "PANTONE 222 CP", "label": "222", "hex": "#702342" }, { "name": "PANTONE 7639 CP", "label": "7639", "hex": "#9c747c" }, { "name": "PANTONE 7640 CP", "label": "7640", "hex": "#a3445e" }, { "name": "PANTONE 7641 CP", "label": "7641", "hex": "#9c294e" }, { "name": "PANTONE 7642 CP", "label": "7642", "hex": "#7a304d" }, { "name": "PANTONE 7643 CP", "label": "7643", "hex": "#6f2f49" }, { "name": "PANTONE 7644 CP", "label": "7644", "hex": "#5c2c40" }, { "name": "PANTONE 7645 CP", "label": "7645", "hex": "#552c3c" }, { "name": "PANTONE 223 CP", "label": "223", "hex": "#f09fc4" }, { "name": "PANTONE 224 CP", "label": "224", "hex": "#e76da4" }, { "name": "PANTONE 225 CP", "label": "225", "hex": "#e13c8b" }, { "name": "PANTONE 226 CP", "label": "226", "hex": "#e3007b" }, { "name": "PANTONE 227 CP", "label": "227", "hex": "#b81566" }, { "name": "PANTONE 228 CP", "label": "228", "hex": "#8f1f54" }, { "name": "PANTONE 229 CP", "label": "229", "hex": "#6b2343" }, { "name": "PANTONE 230 CP", "label": "230", "hex": "#f2b2d0" }, { "name": "PANTONE 231 CP", "label": "231", "hex": "#ea86b4" }, { "name": "PANTONE 232 CP", "label": "232", "hex": "#e36ca4" }, { "name": "PANTONE Rhodamine Red CP", "label": "rhodamine-red", "hex": "#da3f8d" }, { "name": "PANTONE 233 CP", "label": "233", "hex": "#d2067d" }, { "name": "PANTONE 234 CP", "label": "234", "hex": "#af196c" }, { "name": "PANTONE 235 CP", "label": "235", "hex": "#8c1f57" }, { "name": "PANTONE 670 CP", "label": "670", "hex": "#f9e1ed" }, { "name": "PANTONE 671 CP", "label": "671", "hex": "#f2cbe0" }, { "name": "PANTONE 672 CP", "label": "672", "hex": "#e9a6c9" }, { "name": "PANTONE 673 CP", "label": "673", "hex": "#e190bb" }, { "name": "PANTONE 674 CP", "label": "674", "hex": "#d04a92" }, { "name": "PANTONE 675 CP", "label": "675", "hex": "#be1378" }, { "name": "PANTONE 676 CP", "label": "676", "hex": "#a41b5b" }, { "name": "PANTONE 677 CP", "label": "677", "hex": "#f5e0eb" }, { "name": "PANTONE 678 CP", "label": "678", "hex": "#f1d3e4" }, { "name": "PANTONE 679 CP", "label": "679", "hex": "#f0c9df" }, { "name": "PANTONE 680 CP", "label": "680", "hex": "#d998bc" }, { "name": "PANTONE 681 CP", "label": "681", "hex": "#c56a9c" }, { "name": "PANTONE 682 CP", "label": "682", "hex": "#9c3b72" }, { "name": "PANTONE 683 CP", "label": "683", "hex": "#7b2350" }, { "name": "PANTONE 684 CP", "label": "684", "hex": "#f2d5e3" }, { "name": "PANTONE 685 CP", "label": "685", "hex": "#f0c6da" }, { "name": "PANTONE 686 CP", "label": "686", "hex": "#e6acca" }, { "name": "PANTONE 687 CP", "label": "687", "hex": "#cf86ad" }, { "name": "PANTONE 688 CP", "label": "688", "hex": "#bf6797" }, { "name": "PANTONE 689 CP", "label": "689", "hex": "#8f3366" }, { "name": "PANTONE 690 CP", "label": "690", "hex": "#5f2441" }, { "name": "PANTONE 510 CP", "label": "510", "hex": "#f7c8da" }, { "name": "PANTONE 509 CP", "label": "509", "hex": "#f4bcd2" }, { "name": "PANTONE 508 CP", "label": "508", "hex": "#efb0c9" }, { "name": "PANTONE 507 CP", "label": "507", "hex": "#e195b2" }, { "name": "PANTONE 506 CP", "label": "506", "hex": "#773344" }, { "name": "PANTONE 505 CP", "label": "505", "hex": "#6b353d" }, { "name": "PANTONE 504 CP", "label": "504", "hex": "#583037" }, { "name": "PANTONE 7429 CP", "label": "7429", "hex": "#f4cfe0" }, { "name": "PANTONE 7430 CP", "label": "7430", "hex": "#eeb6d0" }, { "name": "PANTONE 7431 CP", "label": "7431", "hex": "#de8db0" }, { "name": "PANTONE 7432 CP", "label": "7432", "hex": "#c75c88" }, { "name": "PANTONE 7433 CP", "label": "7433", "hex": "#b53569" }, { "name": "PANTONE 7434 CP", "label": "7434", "hex": "#a12c58" }, { "name": "PANTONE 7435 CP", "label": "7435", "hex": "#87214c" }, { "name": "PANTONE 691 CP", "label": "691", "hex": "#fae4e7" }, { "name": "PANTONE 692 CP", "label": "692", "hex": "#f2ccd6" }, { "name": "PANTONE 693 CP", "label": "693", "hex": "#e5aebf" }, { "name": "PANTONE 694 CP", "label": "694", "hex": "#d38fa3" }, { "name": "PANTONE 695 CP", "label": "695", "hex": "#bb6f83" }, { "name": "PANTONE 696 CP", "label": "696", "hex": "#933f50" }, { "name": "PANTONE 697 CP", "label": "697", "hex": "#873946" }, { "name": "PANTONE 496 CP", "label": "496", "hex": "#f8cedb" }, { "name": "PANTONE 495 CP", "label": "495", "hex": "#f7c4d4" }, { "name": "PANTONE 494 CP", "label": "494", "hex": "#f3a5bb" }, { "name": "PANTONE 493 CP", "label": "493", "hex": "#e88ba2" }, { "name": "PANTONE 492 CP", "label": "492", "hex": "#8c393e" }, { "name": "PANTONE 491 CP", "label": "491", "hex": "#7a3637" }, { "name": "PANTONE 490 CP", "label": "490", "hex": "#5a3029" }, { "name": "PANTONE 503 CP", "label": "503", "hex": "#f8dae0" }, { "name": "PANTONE 502 CP", "label": "502", "hex": "#f7ced5" }, { "name": "PANTONE 501 CP", "label": "501", "hex": "#eab0be" }, { "name": "PANTONE 500 CP", "label": "500", "hex": "#d08d99" }, { "name": "PANTONE 499 CP", "label": "499", "hex": "#77413e" }, { "name": "PANTONE 498 CP", "label": "498", "hex": "#67382f" }, { "name": "PANTONE 497 CP", "label": "497", "hex": "#4f332b" }, { "name": "PANTONE 5035 CP", "label": "5035", "hex": "#f3d9dc" }, { "name": "PANTONE 5025 CP", "label": "5025", "hex": "#e6bcc2" }, { "name": "PANTONE 5015 CP", "label": "5015", "hex": "#dcaeb7" }, { "name": "PANTONE 5005 CP", "label": "5005", "hex": "#b07781" }, { "name": "PANTONE 4995 CP", "label": "4995", "hex": "#9a5d69" }, { "name": "PANTONE 4985 CP", "label": "4985", "hex": "#834552" }, { "name": "PANTONE 4975 CP", "label": "4975", "hex": "#422a2a" }, { "name": "PANTONE 236 CP", "label": "236", "hex": "#f0bad5" }, { "name": "PANTONE 237 CP", "label": "237", "hex": "#e796be" }, { "name": "PANTONE 238 CP", "label": "238", "hex": "#d8619e" }, { "name": "PANTONE 239 CP", "label": "239", "hex": "#d04d93" }, { "name": "PANTONE 240 CP", "label": "240", "hex": "#c83b8a" }, { "name": "PANTONE 241 CP", "label": "241", "hex": "#b31c7b" }, { "name": "PANTONE 242 CP", "label": "242", "hex": "#802257" }, { "name": "PANTONE 2365 CP", "label": "2365", "hex": "#f4c8de" }, { "name": "PANTONE 2375 CP", "label": "2375", "hex": "#d482b3" }, { "name": "PANTONE 2385 CP", "label": "2385", "hex": "#c44a92" }, { "name": "PANTONE 2395 CP", "label": "2395", "hex": "#bf3a8a" }, { "name": "PANTONE 2405 CP", "label": "2405", "hex": "#ac207f" }, { "name": "PANTONE 2415 CP", "label": "2415", "hex": "#a2217a" }, { "name": "PANTONE 2425 CP", "label": "2425", "hex": "#892464" }, { "name": "PANTONE 243 CP", "label": "243", "hex": "#f0c3db" }, { "name": "PANTONE 244 CP", "label": "244", "hex": "#e3a6ca" }, { "name": "PANTONE 245 CP", "label": "245", "hex": "#d58bb9" }, { "name": "PANTONE 246 CP", "label": "246", "hex": "#b73f8c" }, { "name": "PANTONE 247 CP", "label": "247", "hex": "#af2f84" }, { "name": "PANTONE 248 CP", "label": "248", "hex": "#a2237f" }, { "name": "PANTONE 249 CP", "label": "249", "hex": "#812d64" }, { "name": "PANTONE 7646 CP", "label": "7646", "hex": "#b77992" }, { "name": "PANTONE 7647 CP", "label": "7647", "hex": "#b7417d" }, { "name": "PANTONE 7648 CP", "label": "7648", "hex": "#ad1971" }, { "name": "PANTONE 7649 CP", "label": "7649", "hex": "#9d1e6f" }, { "name": "PANTONE 7650 CP", "label": "7650", "hex": "#7e245f" }, { "name": "PANTONE 7651 CP", "label": "7651", "hex": "#6f2c5d" }, { "name": "PANTONE 7652 CP", "label": "7652", "hex": "#6c2c5b" }, { "name": "PANTONE 250 CP", "label": "250", "hex": "#ebc9e0" }, { "name": "PANTONE 251 CP", "label": "251", "hex": "#d5a7cb" }, { "name": "PANTONE 252 CP", "label": "252", "hex": "#c06fa8" }, { "name": "PANTONE Purple CP", "label": "purple", "hex": "#a73c8a" }, { "name": "PANTONE 253 CP", "label": "253", "hex": "#a43a89" }, { "name": "PANTONE 254 CP", "label": "254", "hex": "#993084" }, { "name": "PANTONE 255 CP", "label": "255", "hex": "#792f6a" }, { "name": "PANTONE 517 CP", "label": "517", "hex": "#f5d1e4" }, { "name": "PANTONE 516 CP", "label": "516", "hex": "#f0c5dd" }, { "name": "PANTONE 515 CP", "label": "515", "hex": "#e6adce" }, { "name": "PANTONE 514 CP", "label": "514", "hex": "#d58ebb" }, { "name": "PANTONE 513 CP", "label": "513", "hex": "#8f2c81" }, { "name": "PANTONE 512 CP", "label": "512", "hex": "#7e2b71" }, { "name": "PANTONE 511 CP", "label": "511", "hex": "#5b254b" }, { "name": "PANTONE 7436 CP", "label": "7436", "hex": "#f8e5f0" }, { "name": "PANTONE 7437 CP", "label": "7437", "hex": "#dcb8d6" }, { "name": "PANTONE 7438 CP", "label": "7438", "hex": "#d39ec6" }, { "name": "PANTONE 7439 CP", "label": "7439", "hex": "#c18fbd" }, { "name": "PANTONE 7440 CP", "label": "7440", "hex": "#b07bb1" }, { "name": "PANTONE 7441 CP", "label": "7441", "hex": "#a164a2" }, { "name": "PANTONE 7442 CP", "label": "7442", "hex": "#85448e" }, { "name": "PANTONE 2562 CP", "label": "2562", "hex": "#d3b5d5" }, { "name": "PANTONE 2572 CP", "label": "2572", "hex": "#bd89b9" }, { "name": "PANTONE 2582 CP", "label": "2582", "hex": "#995196" }, { "name": "PANTONE 2592 CP", "label": "2592", "hex": "#853f8b" }, { "name": "PANTONE 2602 CP", "label": "2602", "hex": "#772f81" }, { "name": "PANTONE 2612 CP", "label": "2612", "hex": "#702f7e" }, { "name": "PANTONE 2622 CP", "label": "2622", "hex": "#5a295e" }, { "name": "PANTONE 7653 CP", "label": "7653", "hex": "#a598a5" }, { "name": "PANTONE 7654 CP", "label": "7654", "hex": "#b486ad" }, { "name": "PANTONE 7655 CP", "label": "7655", "hex": "#b562a0" }, { "name": "PANTONE 7656 CP", "label": "7656", "hex": "#9a3d87" }, { "name": "PANTONE 7657 CP", "label": "7657", "hex": "#752d67" }, { "name": "PANTONE 7658 CP", "label": "7658", "hex": "#6d325e" }, { "name": "PANTONE 7659 CP", "label": "7659", "hex": "#623755" }, { "name": "PANTONE 524 CP", "label": "524", "hex": "#e6d0e5" }, { "name": "PANTONE 523 CP", "label": "523", "hex": "#d8bad8" }, { "name": "PANTONE 522 CP", "label": "522", "hex": "#c8a1c9" }, { "name": "PANTONE 521 CP", "label": "521", "hex": "#b384b7" }, { "name": "PANTONE 520 CP", "label": "520", "hex": "#683576" }, { "name": "PANTONE 519 CP", "label": "519", "hex": "#592f5f" }, { "name": "PANTONE 518 CP", "label": "518", "hex": "#502f48" }, { "name": "PANTONE 5245 CP", "label": "5245", "hex": "#eee3e7" }, { "name": "PANTONE 5235 CP", "label": "5235", "hex": "#e3d0da" }, { "name": "PANTONE 5225 CP", "label": "5225", "hex": "#d2b9c8" }, { "name": "PANTONE 5215 CP", "label": "5215", "hex": "#b796ab" }, { "name": "PANTONE 5205 CP", "label": "5205", "hex": "#835b75" }, { "name": "PANTONE 5195 CP", "label": "5195", "hex": "#5f3b52" }, { "name": "PANTONE 5185 CP", "label": "5185", "hex": "#462d3c" }, { "name": "PANTONE 5175 CP", "label": "5175", "hex": "#ecdbe6" }, { "name": "PANTONE 5165 CP", "label": "5165", "hex": "#e7d5e3" }, { "name": "PANTONE 5155 CP", "label": "5155", "hex": "#d2b5cd" }, { "name": "PANTONE 5145 CP", "label": "5145", "hex": "#a87ea0" }, { "name": "PANTONE 5135 CP", "label": "5135", "hex": "#89547a" }, { "name": "PANTONE 5125 CP", "label": "5125", "hex": "#6c385c" }, { "name": "PANTONE 5115 CP", "label": "5115", "hex": "#4d293f" }, { "name": "PANTONE 531 CP", "label": "531", "hex": "#e8cfe4" }, { "name": "PANTONE 530 CP", "label": "530", "hex": "#dbbbd8" }, { "name": "PANTONE 529 CP", "label": "529", "hex": "#c99fc8" }, { "name": "PANTONE 528 CP", "label": "528", "hex": "#b280b4" }, { "name": "PANTONE 527 CP", "label": "527", "hex": "#703383" }, { "name": "PANTONE 526 CP", "label": "526", "hex": "#683282" }, { "name": "PANTONE 525 CP", "label": "525", "hex": "#51295a" }, { "name": "PANTONE 256 CP", "label": "256", "hex": "#e8d3e6" }, { "name": "PANTONE 257 CP", "label": "257", "hex": "#d4b3d4" }, { "name": "PANTONE 258 CP", "label": "258", "hex": "#935397" }, { "name": "PANTONE 259 CP", "label": "259", "hex": "#70307b" }, { "name": "PANTONE 260 CP", "label": "260", "hex": "#622c67" }, { "name": "PANTONE 261 CP", "label": "261", "hex": "#5b2858" }, { "name": "PANTONE 262 CP", "label": "262", "hex": "#562d51" }, { "name": "PANTONE 2563 CP", "label": "2563", "hex": "#ccacd0" }, { "name": "PANTONE 2573 CP", "label": "2573", "hex": "#b28cbc" }, { "name": "PANTONE 2583 CP", "label": "2583", "hex": "#9b60a0" }, { "name": "PANTONE 2593 CP", "label": "2593", "hex": "#753c89" }, { "name": "PANTONE 2603 CP", "label": "2603", "hex": "#683381" }, { "name": "PANTONE 2613 CP", "label": "2613", "hex": "#5f3377" }, { "name": "PANTONE 2623 CP", "label": "2623", "hex": "#552f69" }, { "name": "PANTONE 7660 CP", "label": "7660", "hex": "#afa5b9" }, { "name": "PANTONE 7661 CP", "label": "7661", "hex": "#9a77a2" }, { "name": "PANTONE 7662 CP", "label": "7662", "hex": "#814489" }, { "name": "PANTONE 7663 CP", "label": "7663", "hex": "#6a307c" }, { "name": "PANTONE 7664 CP", "label": "7664", "hex": "#60317a" }, { "name": "PANTONE 7665 CP", "label": "7665", "hex": "#5f3b73" }, { "name": "PANTONE 7666 CP", "label": "7666", "hex": "#605064" }, { "name": "PANTONE 2567 CP", "label": "2567", "hex": "#be9dc7" }, { "name": "PANTONE 2577 CP", "label": "2577", "hex": "#a786b9" }, { "name": "PANTONE 2587 CP", "label": "2587", "hex": "#84579a" }, { "name": "PANTONE 2597 CP", "label": "2597", "hex": "#593684" }, { "name": "PANTONE 2607 CP", "label": "2607", "hex": "#523683" }, { "name": "PANTONE 2617 CP", "label": "2617", "hex": "#4c347b" }, { "name": "PANTONE 2627 CP", "label": "2627", "hex": "#3f2e61" }, { "name": "PANTONE 263 CP", "label": "263", "hex": "#e7dbeb" }, { "name": "PANTONE 264 CP", "label": "264", "hex": "#c4aed2" }, { "name": "PANTONE 265 CP", "label": "265", "hex": "#8f6ba8" }, { "name": "PANTONE 266 CP", "label": "266", "hex": "#5f418c" }, { "name": "PANTONE 267 CP", "label": "267", "hex": "#553986" }, { "name": "PANTONE 268 CP", "label": "268", "hex": "#4f357c" }, { "name": "PANTONE 269 CP", "label": "269", "hex": "#4c316b" }, { "name": "PANTONE 2635 CP", "label": "2635", "hex": "#c9bcdb" }, { "name": "PANTONE 2645 CP", "label": "2645", "hex": "#a699c6" }, { "name": "PANTONE 2655 CP", "label": "2655", "hex": "#8973ae" }, { "name": "PANTONE 2665 CP", "label": "2665", "hex": "#68559a" }, { "name": "PANTONE Violet CP", "label": "violet", "hex": "#443785" }, { "name": "PANTONE 2685 CP", "label": "2685", "hex": "#41367f" }, { "name": "PANTONE 2695 CP", "label": "2695", "hex": "#31294e" }, { "name": "PANTONE 270 CP", "label": "270", "hex": "#bec0df" }, { "name": "PANTONE 271 CP", "label": "271", "hex": "#9194c5" }, { "name": "PANTONE 272 CP", "label": "272", "hex": "#7679b4" }, { "name": "PANTONE 273 CP", "label": "273", "hex": "#253374" }, { "name": "PANTONE 274 CP", "label": "274", "hex": "#253062" }, { "name": "PANTONE 275 CP", "label": "275", "hex": "#262b52" }, { "name": "PANTONE 276 CP", "label": "276", "hex": "#26243a" }, { "name": "PANTONE 2705 CP", "label": "2705", "hex": "#a5a6d0" }, { "name": "PANTONE 2715 CP", "label": "2715", "hex": "#8282b9" }, { "name": "PANTONE 2725 CP", "label": "2725", "hex": "#5a549a" }, { "name": "PANTONE 2735 CP", "label": "2735", "hex": "#313682" }, { "name": "PANTONE 2745 CP", "label": "2745", "hex": "#2e3477" }, { "name": "PANTONE 2755 CP", "label": "2755", "hex": "#2c316d" }, { "name": "PANTONE 2765 CP", "label": "2765", "hex": "#262b50" }, { "name": "PANTONE 7667 CP", "label": "7667", "hex": "#6c85aa" }, { "name": "PANTONE 7668 CP", "label": "7668", "hex": "#6776aa" }, { "name": "PANTONE 7669 CP", "label": "7669", "hex": "#5b63a4" }, { "name": "PANTONE 7670 CP", "label": "7670", "hex": "#4f569c" }, { "name": "PANTONE 7671 CP", "label": "7671", "hex": "#4a4b91" }, { "name": "PANTONE 7672 CP", "label": "7672", "hex": "#45478d" }, { "name": "PANTONE 7673 CP", "label": "7673", "hex": "#4d568c" }, { "name": "PANTONE 7443 CP", "label": "7443", "hex": "#e9e9f3" }, { "name": "PANTONE 7444 CP", "label": "7444", "hex": "#c2c7e3" }, { "name": "PANTONE 7445 CP", "label": "7445", "hex": "#aaaad0" }, { "name": "PANTONE 7446 CP", "label": "7446", "hex": "#9090c2" }, { "name": "PANTONE 7447 CP", "label": "7447", "hex": "#53417c" }, { "name": "PANTONE 7448 CP", "label": "7448", "hex": "#46354d" }, { "name": "PANTONE 7449 CP", "label": "7449", "hex": "#382332" }, { "name": "PANTONE 7674 CP", "label": "7674", "hex": "#8f98c3" }, { "name": "PANTONE 7675 CP", "label": "7675", "hex": "#8489b8" }, { "name": "PANTONE 7676 CP", "label": "7676", "hex": "#7a6ba6" }, { "name": "PANTONE 7677 CP", "label": "7677", "hex": "#6f5298" }, { "name": "PANTONE 7678 CP", "label": "7678", "hex": "#624791" }, { "name": "PANTONE 7679 CP", "label": "7679", "hex": "#493987" }, { "name": "PANTONE 7680 CP", "label": "7680", "hex": "#47357f" }, { "name": "PANTONE 663 CP", "label": "663", "hex": "#f4f0f5" }, { "name": "PANTONE 664 CP", "label": "664", "hex": "#ede9f1" }, { "name": "PANTONE 665 CP", "label": "665", "hex": "#d7cfe5" }, { "name": "PANTONE 666 CP", "label": "666", "hex": "#a89ec4" }, { "name": "PANTONE 667 CP", "label": "667", "hex": "#776a9c" }, { "name": "PANTONE 668 CP", "label": "668", "hex": "#5a487d" }, { "name": "PANTONE 669 CP", "label": "669", "hex": "#382e58" }, { "name": "PANTONE 5315 CP", "label": "5315", "hex": "#e2e5ee" }, { "name": "PANTONE 5305 CP", "label": "5305", "hex": "#cecfe0" }, { "name": "PANTONE 5295 CP", "label": "5295", "hex": "#b8bbd2" }, { "name": "PANTONE 5285 CP", "label": "5285", "hex": "#8d8caf" }, { "name": "PANTONE 5275 CP", "label": "5275", "hex": "#4a4d7c" }, { "name": "PANTONE 5265 CP", "label": "5265", "hex": "#363862" }, { "name": "PANTONE 5255 CP", "label": "5255", "hex": "#29273f" }, { "name": "PANTONE 538 CP", "label": "538", "hex": "#dce8f1" }, { "name": "PANTONE 537 CP", "label": "537", "hex": "#ccddeb" }, { "name": "PANTONE 536 CP", "label": "536", "hex": "#a9bfd8" }, { "name": "PANTONE 535 CP", "label": "535", "hex": "#94abcb" }, { "name": "PANTONE 534 CP", "label": "534", "hex": "#1e3e6a" }, { "name": "PANTONE 533 CP", "label": "533", "hex": "#20334d" }, { "name": "PANTONE 532 CP", "label": "532", "hex": "#272b36" }, { "name": "PANTONE 7541 CP", "label": "7541", "hex": "#edf4f4" }, { "name": "PANTONE 7542 CP", "label": "7542", "hex": "#b9cfd4" }, { "name": "PANTONE 7543 CP", "label": "7543", "hex": "#abbac2" }, { "name": "PANTONE 7544 CP", "label": "7544", "hex": "#8699a4" }, { "name": "PANTONE 7545 CP", "label": "7545", "hex": "#4b606f" }, { "name": "PANTONE 7546 CP", "label": "7546", "hex": "#324655" }, { "name": "PANTONE 7547 CP", "label": "7547", "hex": "#1f2934" }, { "name": "PANTONE 552 CP", "label": "552", "hex": "#c9e2e8" }, { "name": "PANTONE 551 CP", "label": "551", "hex": "#a8d0dc" }, { "name": "PANTONE 550 CP", "label": "550", "hex": "#95c4d6" }, { "name": "PANTONE 549 CP", "label": "549", "hex": "#61a4ba" }, { "name": "PANTONE 548 CP", "label": "548", "hex": "#00414c" }, { "name": "PANTONE 547 CP", "label": "547", "hex": "#06373f" }, { "name": "PANTONE 546 CP", "label": "546", "hex": "#113036" }, { "name": "PANTONE 5455 CP", "label": "5455", "hex": "#d5e4e8" }, { "name": "PANTONE 5445 CP", "label": "5445", "hex": "#c6d9e2" }, { "name": "PANTONE 5435 CP", "label": "5435", "hex": "#acc8d6" }, { "name": "PANTONE 5425 CP", "label": "5425", "hex": "#7e9fb3" }, { "name": "PANTONE 5415 CP", "label": "5415", "hex": "#5d8299" }, { "name": "PANTONE 5405 CP", "label": "5405", "hex": "#436981" }, { "name": "PANTONE 5395 CP", "label": "5395", "hex": "#1d272d" }, { "name": "PANTONE 642 CP", "label": "642", "hex": "#e2eff6" }, { "name": "PANTONE 643 CP", "label": "643", "hex": "#d1e6f2" }, { "name": "PANTONE 644 CP", "label": "644", "hex": "#97c4de" }, { "name": "PANTONE 645 CP", "label": "645", "hex": "#6fa7ce" }, { "name": "PANTONE 646 CP", "label": "646", "hex": "#398ab9" }, { "name": "PANTONE 647 CP", "label": "647", "hex": "#00598c" }, { "name": "PANTONE 648 CP", "label": "648", "hex": "#11395d" }, { "name": "PANTONE 649 CP", "label": "649", "hex": "#e9f1f8" }, { "name": "PANTONE 650 CP", "label": "650", "hex": "#d5e4f0" }, { "name": "PANTONE 651 CP", "label": "651", "hex": "#a6c7e3" }, { "name": "PANTONE 652 CP", "label": "652", "hex": "#6da2cd" }, { "name": "PANTONE 653 CP", "label": "653", "hex": "#005d96" }, { "name": "PANTONE 654 CP", "label": "654", "hex": "#093e66" }, { "name": "PANTONE 655 CP", "label": "655", "hex": "#1b3455" }, { "name": "PANTONE 656 CP", "label": "656", "hex": "#e9f3fb" }, { "name": "PANTONE 657 CP", "label": "657", "hex": "#cfe3f4" }, { "name": "PANTONE 658 CP", "label": "658", "hex": "#abcfeb" }, { "name": "PANTONE 659 CP", "label": "659", "hex": "#6ea6d5" }, { "name": "PANTONE 660 CP", "label": "660", "hex": "#0075b7" }, { "name": "PANTONE 661 CP", "label": "661", "hex": "#004f96" }, { "name": "PANTONE 662 CP", "label": "662", "hex": "#173e7f" }, { "name": "PANTONE 7450 CP", "label": "7450", "hex": "#c7d6ec" }, { "name": "PANTONE 7451 CP", "label": "7451", "hex": "#94b6dd" }, { "name": "PANTONE 7452 CP", "label": "7452", "hex": "#7f9bcc" }, { "name": "PANTONE 7453 CP", "label": "7453", "hex": "#80add8" }, { "name": "PANTONE 7454 CP", "label": "7454", "hex": "#5a9ac1" }, { "name": "PANTONE 7455 CP", "label": "7455", "hex": "#215fa5" }, { "name": "PANTONE 7456 CP", "label": "7456", "hex": "#5676b3" }, { "name": "PANTONE 2706 CP", "label": "2706", "hex": "#d6dff0" }, { "name": "PANTONE 2716 CP", "label": "2716", "hex": "#a5b2d8" }, { "name": "PANTONE 2726 CP", "label": "2726", "hex": "#495ca1" }, { "name": "PANTONE 2736 CP", "label": "2736", "hex": "#2e3c89" }, { "name": "PANTONE 2746 CP", "label": "2746", "hex": "#263987" }, { "name": "PANTONE 2756 CP", "label": "2756", "hex": "#24367b" }, { "name": "PANTONE 2766 CP", "label": "2766", "hex": "#262a4f" }, { "name": "PANTONE 2708 CP", "label": "2708", "hex": "#bbd2eb" }, { "name": "PANTONE 2718 CP", "label": "2718", "hex": "#6588c0" }, { "name": "PANTONE 2728 CP", "label": "2728", "hex": "#265ca3" }, { "name": "PANTONE 2738 CP", "label": "2738", "hex": "#1e3f8b" }, { "name": "PANTONE 2748 CP", "label": "2748", "hex": "#213a80" }, { "name": "PANTONE 2758 CP", "label": "2758", "hex": "#223366" }, { "name": "PANTONE 2768 CP", "label": "2768", "hex": "#232a44" }, { "name": "PANTONE 2707 CP", "label": "2707", "hex": "#d3e5f4" }, { "name": "PANTONE 2717 CP", "label": "2717", "hex": "#b2cce8" }, { "name": "PANTONE 2727 CP", "label": "2727", "hex": "#5682bd" }, { "name": "PANTONE Blue 072 CP", "label": "blue-072", "hex": "#223c87" }, { "name": "PANTONE 2747 CP", "label": "2747", "hex": "#21397d" }, { "name": "PANTONE 2757 CP", "label": "2757", "hex": "#223263" }, { "name": "PANTONE 2767 CP", "label": "2767", "hex": "#23283f" }, { "name": "PANTONE 277 CP", "label": "277", "hex": "#b0d4ee" }, { "name": "PANTONE 278 CP", "label": "278", "hex": "#95c4e6" }, { "name": "PANTONE 279 CP", "label": "279", "hex": "#5396cc" }, { "name": "PANTONE Reflex Blue CP", "label": "reflex-blue", "hex": "#19428e" }, { "name": "PANTONE 280 CP", "label": "280", "hex": "#163f7a" }, { "name": "PANTONE 281 CP", "label": "281", "hex": "#193a6d" }, { "name": "PANTONE 282 CP", "label": "282", "hex": "#222b47" }, { "name": "PANTONE 283 CP", "label": "283", "hex": "#9dceec" }, { "name": "PANTONE 284 CP", "label": "284", "hex": "#68b4df" }, { "name": "PANTONE 285 CP", "label": "285", "hex": "#0077b9" }, { "name": "PANTONE 286 CP", "label": "286", "hex": "#00519b" }, { "name": "PANTONE 287 CP", "label": "287", "hex": "#004988" }, { "name": "PANTONE 288 CP", "label": "288", "hex": "#0f3f74" }, { "name": "PANTONE 289 CP", "label": "289", "hex": "#1c304a" }, { "name": "PANTONE 7681 CP", "label": "7681", "hex": "#9fb9db" }, { "name": "PANTONE 7682 CP", "label": "7682", "hex": "#6695c8" }, { "name": "PANTONE 7683 CP", "label": "7683", "hex": "#2d71b2" }, { "name": "PANTONE 7684 CP", "label": "7684", "hex": "#1b62a7" }, { "name": "PANTONE 7685 CP", "label": "7685", "hex": "#0059a1" }, { "name": "PANTONE 7686 CP", "label": "7686", "hex": "#004f93" }, { "name": "PANTONE 7687 CP", "label": "7687", "hex": "#004687" }, { "name": "PANTONE 545 CP", "label": "545", "hex": "#cfe8f6" }, { "name": "PANTONE 544 CP", "label": "544", "hex": "#c1e0f1" }, { "name": "PANTONE 543 CP", "label": "543", "hex": "#a9d0eb" }, { "name": "PANTONE 542 CP", "label": "542", "hex": "#63acd6" }, { "name": "PANTONE 541 CP", "label": "541", "hex": "#004870" }, { "name": "PANTONE 540 CP", "label": "540", "hex": "#053b56" }, { "name": "PANTONE 539 CP", "label": "539", "hex": "#192e3e" }, { "name": "PANTONE 290 CP", "label": "290", "hex": "#cdebf7" }, { "name": "PANTONE 291 CP", "label": "291", "hex": "#a7d8f2" }, { "name": "PANTONE 292 CP", "label": "292", "hex": "#65bbe5" }, { "name": "PANTONE 293 CP", "label": "293", "hex": "#00569d" }, { "name": "PANTONE 294 CP", "label": "294", "hex": "#00487c" }, { "name": "PANTONE 295 CP", "label": "295", "hex": "#0c3c61" }, { "name": "PANTONE 296 CP", "label": "296", "hex": "#1e2833" }, { "name": "PANTONE 2905 CP", "label": "2905", "hex": "#90d4f0" }, { "name": "PANTONE 2915 CP", "label": "2915", "hex": "#5ebde6" }, { "name": "PANTONE 2925 CP", "label": "2925", "hex": "#0099d4" }, { "name": "PANTONE 2935 CP", "label": "2935", "hex": "#006cb3" }, { "name": "PANTONE 2945 CP", "label": "2945", "hex": "#00609d" }, { "name": "PANTONE 2955 CP", "label": "2955", "hex": "#004266" }, { "name": "PANTONE 2965 CP", "label": "2965", "hex": "#183043" }, { "name": "PANTONE 297 CP", "label": "297", "hex": "#79d0ef" }, { "name": "PANTONE 298 CP", "label": "298", "hex": "#2dbeea" }, { "name": "PANTONE 299 CP", "label": "299", "hex": "#00a6df" }, { "name": "PANTONE 300 CP", "label": "300", "hex": "#0070b5" }, { "name": "PANTONE 301 CP", "label": "301", "hex": "#005f98" }, { "name": "PANTONE 302 CP", "label": "302", "hex": "#004664" }, { "name": "PANTONE 303 CP", "label": "303", "hex": "#0f3240" }, { "name": "PANTONE 7688 CP", "label": "7688", "hex": "#3ea8d5" }, { "name": "PANTONE 7689 CP", "label": "7689", "hex": "#049aca" }, { "name": "PANTONE 7690 CP", "label": "7690", "hex": "#007bb2" }, { "name": "PANTONE 7691 CP", "label": "7691", "hex": "#005f95" }, { "name": "PANTONE 7692 CP", "label": "7692", "hex": "#005280" }, { "name": "PANTONE 7693 CP", "label": "7693", "hex": "#004870" }, { "name": "PANTONE 7694 CP", "label": "7694", "hex": "#00456a" }, { "name": "PANTONE 2975 CP", "label": "2975", "hex": "#b2e1ee" }, { "name": "PANTONE 2985 CP", "label": "2985", "hex": "#59c7e9" }, { "name": "PANTONE 2995 CP", "label": "2995", "hex": "#00afe5" }, { "name": "PANTONE 3005 CP", "label": "3005", "hex": "#0083c7" }, { "name": "PANTONE 3015 CP", "label": "3015", "hex": "#006ea5" }, { "name": "PANTONE 3025 CP", "label": "3025", "hex": "#005372" }, { "name": "PANTONE 3035 CP", "label": "3035", "hex": "#003e4e" }, { "name": "PANTONE 7695 CP", "label": "7695", "hex": "#93c1d4" }, { "name": "PANTONE 7696 CP", "label": "7696", "hex": "#61a3ba" }, { "name": "PANTONE 7697 CP", "label": "7697", "hex": "#358fad" }, { "name": "PANTONE 7698 CP", "label": "7698", "hex": "#33728b" }, { "name": "PANTONE 7699 CP", "label": "7699", "hex": "#1e6581" }, { "name": "PANTONE 7700 CP", "label": "7700", "hex": "#005e7e" }, { "name": "PANTONE 7701 CP", "label": "7701", "hex": "#005f80" }, { "name": "PANTONE 7457 CP", "label": "7457", "hex": "#d9eff2" }, { "name": "PANTONE 7458 CP", "label": "7458", "hex": "#73bdd4" }, { "name": "PANTONE 7459 CP", "label": "7459", "hex": "#16a0c2" }, { "name": "PANTONE 7460 CP", "label": "7460", "hex": "#0091ca" }, { "name": "PANTONE 7461 CP", "label": "7461", "hex": "#0089c8" }, { "name": "PANTONE 7462 CP", "label": "7462", "hex": "#005b8c" }, { "name": "PANTONE 7463 CP", "label": "7463", "hex": "#103752" }, { "name": "PANTONE 304 CP", "label": "304", "hex": "#b2e0ed" }, { "name": "PANTONE 305 CP", "label": "305", "hex": "#73cde7" }, { "name": "PANTONE 306 CP", "label": "306", "hex": "#00b8e1" }, { "name": "PANTONE Process Blue CP", "label": "process-blue", "hex": "#0093d2" }, { "name": "PANTONE 307 CP", "label": "307", "hex": "#007cb3" }, { "name": "PANTONE 308 CP", "label": "308", "hex": "#005f81" }, { "name": "PANTONE 309 CP", "label": "309", "hex": "#003b47" }, { "name": "PANTONE 635 CP", "label": "635", "hex": "#bce4ec" }, { "name": "PANTONE 636 CP", "label": "636", "hex": "#a6dce9" }, { "name": "PANTONE 637 CP", "label": "637", "hex": "#52c4e1" }, { "name": "PANTONE 638 CP", "label": "638", "hex": "#00acd7" }, { "name": "PANTONE 639 CP", "label": "639", "hex": "#009bd1" }, { "name": "PANTONE 640 CP", "label": "640", "hex": "#0087bd" }, { "name": "PANTONE 641 CP", "label": "641", "hex": "#007ab4" }, { "name": "PANTONE 7702 CP", "label": "7702", "hex": "#2cb3d3" }, { "name": "PANTONE 7703 CP", "label": "7703", "hex": "#00a4c6" }, { "name": "PANTONE 7704 CP", "label": "7704", "hex": "#0088b1" }, { "name": "PANTONE 7705 CP", "label": "7705", "hex": "#006b93" }, { "name": "PANTONE 7706 CP", "label": "7706", "hex": "#006688" }, { "name": "PANTONE 7707 CP", "label": "7707", "hex": "#005c7a" }, { "name": "PANTONE 7708 CP", "label": "7708", "hex": "#005570" }, { "name": "PANTONE 628 CP", "label": "628", "hex": "#d5edee" }, { "name": "PANTONE 629 CP", "label": "629", "hex": "#aedee7" }, { "name": "PANTONE 630 CP", "label": "630", "hex": "#8bd3e2" }, { "name": "PANTONE 631 CP", "label": "631", "hex": "#00b7d5" }, { "name": "PANTONE 632 CP", "label": "632", "hex": "#009cc1" }, { "name": "PANTONE 633 CP", "label": "633", "hex": "#007da4" }, { "name": "PANTONE 634 CP", "label": "634", "hex": "#006b8e" }, { "name": "PANTONE 310 CP", "label": "310", "hex": "#8bd3e4" }, { "name": "PANTONE 311 CP", "label": "311", "hex": "#2fbed7" }, { "name": "PANTONE 312 CP", "label": "312", "hex": "#00aad4" }, { "name": "PANTONE 313 CP", "label": "313", "hex": "#009dcd" }, { "name": "PANTONE 314 CP", "label": "314", "hex": "#0089b0" }, { "name": "PANTONE 315 CP", "label": "315", "hex": "#006880" }, { "name": "PANTONE 316 CP", "label": "316", "hex": "#00464e" }, { "name": "PANTONE 3105 CP", "label": "3105", "hex": "#98d6e1" }, { "name": "PANTONE 3115 CP", "label": "3115", "hex": "#63c7d8" }, { "name": "PANTONE 3125 CP", "label": "3125", "hex": "#00adca" }, { "name": "PANTONE 3135 CP", "label": "3135", "hex": "#009ec2" }, { "name": "PANTONE 3145 CP", "label": "3145", "hex": "#008196" }, { "name": "PANTONE 3155 CP", "label": "3155", "hex": "#006675" }, { "name": "PANTONE 3165 CP", "label": "3165", "hex": "#004e58" }, { "name": "PANTONE 7709 CP", "label": "7709", "hex": "#53bbc8" }, { "name": "PANTONE 7710 CP", "label": "7710", "hex": "#00afc2" }, { "name": "PANTONE 7711 CP", "label": "7711", "hex": "#009bb1" }, { "name": "PANTONE 7712 CP", "label": "7712", "hex": "#00889d" }, { "name": "PANTONE 7713 CP", "label": "7713", "hex": "#008292" }, { "name": "PANTONE 7714 CP", "label": "7714", "hex": "#006f7a" }, { "name": "PANTONE 7715 CP", "label": "7715", "hex": "#006166" }, { "name": "PANTONE 317 CP", "label": "317", "hex": "#ceeae8" }, { "name": "PANTONE 318 CP", "label": "318", "hex": "#a4d9dd" }, { "name": "PANTONE 319 CP", "label": "319", "hex": "#66c5cb" }, { "name": "PANTONE 320 CP", "label": "320", "hex": "#009eaf" }, { "name": "PANTONE 321 CP", "label": "321", "hex": "#00909b" }, { "name": "PANTONE 322 CP", "label": "322", "hex": "#00747a" }, { "name": "PANTONE 323 CP", "label": "323", "hex": "#00595c" }, { "name": "PANTONE 7464 CP", "label": "7464", "hex": "#b2ded8" }, { "name": "PANTONE 7465 CP", "label": "7465", "hex": "#6ec4b2" }, { "name": "PANTONE 7466 CP", "label": "7466", "hex": "#00a9b2" }, { "name": "PANTONE 7467 CP", "label": "7467", "hex": "#00a0b2" }, { "name": "PANTONE 7468 CP", "label": "7468", "hex": "#007aa2" }, { "name": "PANTONE 7469 CP", "label": "7469", "hex": "#005e86" }, { "name": "PANTONE 7470 CP", "label": "7470", "hex": "#005b6e" }, { "name": "PANTONE 7471 CP", "label": "7471", "hex": "#addcd9" }, { "name": "PANTONE 7472 CP", "label": "7472", "hex": "#7ac9c3" }, { "name": "PANTONE 7473 CP", "label": "7473", "hex": "#1ca993" }, { "name": "PANTONE 7474 CP", "label": "7474", "hex": "#007b88" }, { "name": "PANTONE 7475 CP", "label": "7475", "hex": "#378185" }, { "name": "PANTONE 7476 CP", "label": "7476", "hex": "#005057" }, { "name": "PANTONE 7477 CP", "label": "7477", "hex": "#0f4b5a" }, { "name": "PANTONE 5523 CP", "label": "5523", "hex": "#cee6e6" }, { "name": "PANTONE 5513 CP", "label": "5513", "hex": "#b9dbde" }, { "name": "PANTONE 5503 CP", "label": "5503", "hex": "#9bc9cd" }, { "name": "PANTONE 5493 CP", "label": "5493", "hex": "#80b6bd" }, { "name": "PANTONE 5483 CP", "label": "5483", "hex": "#469099" }, { "name": "PANTONE 5473 CP", "label": "5473", "hex": "#00616b" }, { "name": "PANTONE 5463 CP", "label": "5463", "hex": "#152d31" }, { "name": "PANTONE 7716 CP", "label": "7716", "hex": "#009e99" }, { "name": "PANTONE 7717 CP", "label": "7717", "hex": "#008a83" }, { "name": "PANTONE 7718 CP", "label": "7718", "hex": "#00726d" }, { "name": "PANTONE 7719 CP", "label": "7719", "hex": "#006861" }, { "name": "PANTONE 7720 CP", "label": "7720", "hex": "#00605a" }, { "name": "PANTONE 7721 CP", "label": "7721", "hex": "#005a56" }, { "name": "PANTONE 7722 CP", "label": "7722", "hex": "#00504c" }, { "name": "PANTONE 324 CP", "label": "324", "hex": "#b2dedf" }, { "name": "PANTONE 325 CP", "label": "325", "hex": "#7dcbca" }, { "name": "PANTONE 326 CP", "label": "326", "hex": "#00ada7" }, { "name": "PANTONE 327 CP", "label": "327", "hex": "#008973" }, { "name": "PANTONE 328 CP", "label": "328", "hex": "#006c5c" }, { "name": "PANTONE 329 CP", "label": "329", "hex": "#005f53" }, { "name": "PANTONE 330 CP", "label": "330", "hex": "#024f45" }, { "name": "PANTONE 3242 CP", "label": "3242", "hex": "#9ad5d2" }, { "name": "PANTONE 3252 CP", "label": "3252", "hex": "#8bcfcb" }, { "name": "PANTONE 3262 CP", "label": "3262", "hex": "#00b2aa" }, { "name": "PANTONE 3272 CP", "label": "3272", "hex": "#00a095" }, { "name": "PANTONE 3282 CP", "label": "3282", "hex": "#008e7e" }, { "name": "PANTONE 3292 CP", "label": "3292", "hex": "#005e4d" }, { "name": "PANTONE 3302 CP", "label": "3302", "hex": "#094b3e" }, { "name": "PANTONE 3245 CP", "label": "3245", "hex": "#a0d6cc" }, { "name": "PANTONE 3255 CP", "label": "3255", "hex": "#8fd0c8" }, { "name": "PANTONE 3265 CP", "label": "3265", "hex": "#4dbcab" }, { "name": "PANTONE 3275 CP", "label": "3275", "hex": "#00a38e" }, { "name": "PANTONE 3285 CP", "label": "3285", "hex": "#009a81" }, { "name": "PANTONE 3295 CP", "label": "3295", "hex": "#007b62" }, { "name": "PANTONE 3305 CP", "label": "3305", "hex": "#054a3b" }, { "name": "PANTONE 3248 CP", "label": "3248", "hex": "#8ed1ce" }, { "name": "PANTONE 3258 CP", "label": "3258", "hex": "#69c4bc" }, { "name": "PANTONE 3268 CP", "label": "3268", "hex": "#00a68d" }, { "name": "PANTONE 3278 CP", "label": "3278", "hex": "#009870" }, { "name": "PANTONE 3288 CP", "label": "3288", "hex": "#008a69" }, { "name": "PANTONE 3298 CP", "label": "3298", "hex": "#006e52" }, { "name": "PANTONE 3308 CP", "label": "3308", "hex": "#0a4335" }, { "name": "PANTONE 566 CP", "label": "566", "hex": "#ddefe6" }, { "name": "PANTONE 565 CP", "label": "565", "hex": "#bee2d9" }, { "name": "PANTONE 564 CP", "label": "564", "hex": "#9dd5cd" }, { "name": "PANTONE 563 CP", "label": "563", "hex": "#79c6bd" }, { "name": "PANTONE 562 CP", "label": "562", "hex": "#007668" }, { "name": "PANTONE 561 CP", "label": "561", "hex": "#115d50" }, { "name": "PANTONE 560 CP", "label": "560", "hex": "#233e34" }, { "name": "PANTONE 573 CP", "label": "573", "hex": "#d6ece2" }, { "name": "PANTONE 572 CP", "label": "572", "hex": "#c6e5da" }, { "name": "PANTONE 571 CP", "label": "571", "hex": "#a6d8ca" }, { "name": "PANTONE 570 CP", "label": "570", "hex": "#72c5b2" }, { "name": "PANTONE 569 CP", "label": "569", "hex": "#008b71" }, { "name": "PANTONE 568 CP", "label": "568", "hex": "#006a56" }, { "name": "PANTONE 567 CP", "label": "567", "hex": "#194337" }, { "name": "PANTONE 559 CP", "label": "559", "hex": "#bedac9" }, { "name": "PANTONE 558 CP", "label": "558", "hex": "#acd1bf" }, { "name": "PANTONE 557 CP", "label": "557", "hex": "#92bea5" }, { "name": "PANTONE 556 CP", "label": "556", "hex": "#75aa8b" }, { "name": "PANTONE 555 CP", "label": "555", "hex": "#226343" }, { "name": "PANTONE 554 CP", "label": "554", "hex": "#1b563c" }, { "name": "PANTONE 553 CP", "label": "553", "hex": "#214237" }, { "name": "PANTONE 5595 CP", "label": "5595", "hex": "#d0e0d6" }, { "name": "PANTONE 5585 CP", "label": "5585", "hex": "#c3d7cc" }, { "name": "PANTONE 5575 CP", "label": "5575", "hex": "#9fbbaf" }, { "name": "PANTONE 5565 CP", "label": "5565", "hex": "#83a194" }, { "name": "PANTONE 5555 CP", "label": "5555", "hex": "#678a7c" }, { "name": "PANTONE 5545 CP", "label": "5545", "hex": "#486d63" }, { "name": "PANTONE 5535 CP", "label": "5535", "hex": "#233931" }, { "name": "PANTONE 5665 CP", "label": "5665", "hex": "#d7e2d6" }, { "name": "PANTONE 5655 CP", "label": "5655", "hex": "#c8d6c8" }, { "name": "PANTONE 5645 CP", "label": "5645", "hex": "#b7c9bb" }, { "name": "PANTONE 5635 CP", "label": "5635", "hex": "#9cb09e" }, { "name": "PANTONE 5625 CP", "label": "5625", "hex": "#728774" }, { "name": "PANTONE 5615 CP", "label": "5615", "hex": "#566d58" }, { "name": "PANTONE 5605 CP", "label": "5605", "hex": "#203226" }, { "name": "PANTONE 5527 CP", "label": "5527", "hex": "#d9e3df" }, { "name": "PANTONE 5517 CP", "label": "5517", "hex": "#c6d6d1" }, { "name": "PANTONE 5507 CP", "label": "5507", "hex": "#acc2bd" }, { "name": "PANTONE 5497 CP", "label": "5497", "hex": "#849e9b" }, { "name": "PANTONE 5487 CP", "label": "5487", "hex": "#5a756f" }, { "name": "PANTONE 5477 CP", "label": "5477", "hex": "#375450" }, { "name": "PANTONE 5467 CP", "label": "5467", "hex": "#1c2f2b" }, { "name": "PANTONE 621 CP", "label": "621", "hex": "#e4eee3" }, { "name": "PANTONE 622 CP", "label": "622", "hex": "#c3dcd0" }, { "name": "PANTONE 623 CP", "label": "623", "hex": "#a2c6b9" }, { "name": "PANTONE 624 CP", "label": "624", "hex": "#7ea99b" }, { "name": "PANTONE 625 CP", "label": "625", "hex": "#4f8678" }, { "name": "PANTONE 626 CP", "label": "626", "hex": "#1d6052" }, { "name": "PANTONE 627 CP", "label": "627", "hex": "#16362e" }, { "name": "PANTONE 331 CP", "label": "331", "hex": "#c5e5df" }, { "name": "PANTONE 332 CP", "label": "332", "hex": "#b7dfd8" }, { "name": "PANTONE 333 CP", "label": "333", "hex": "#8ccec3" }, { "name": "PANTONE Green CP", "label": "green", "hex": "#009e7a" }, { "name": "PANTONE 334 CP", "label": "334", "hex": "#00986e" }, { "name": "PANTONE 335 CP", "label": "335", "hex": "#008362" }, { "name": "PANTONE 336 CP", "label": "336", "hex": "#00684e" }, { "name": "PANTONE 337 CP", "label": "337", "hex": "#a9d9d0" }, { "name": "PANTONE 338 CP", "label": "338", "hex": "#8acdbd" }, { "name": "PANTONE 339 CP", "label": "339", "hex": "#00a783" }, { "name": "PANTONE 340 CP", "label": "340", "hex": "#009658" }, { "name": "PANTONE 341 CP", "label": "341", "hex": "#007e4f" }, { "name": "PANTONE 342 CP", "label": "342", "hex": "#006a4a" }, { "name": "PANTONE 343 CP", "label": "343", "hex": "#015640" }, { "name": "PANTONE 7723 CP", "label": "7723", "hex": "#42ad87" }, { "name": "PANTONE 7724 CP", "label": "7724", "hex": "#009b6d" }, { "name": "PANTONE 7725 CP", "label": "7725", "hex": "#00894f" }, { "name": "PANTONE 7726 CP", "label": "7726", "hex": "#007841" }, { "name": "PANTONE 7727 CP", "label": "7727", "hex": "#006739" }, { "name": "PANTONE 7728 CP", "label": "7728", "hex": "#006244" }, { "name": "PANTONE 7729 CP", "label": "7729", "hex": "#00563d" }, { "name": "PANTONE 3375 CP", "label": "3375", "hex": "#b0dbcd" }, { "name": "PANTONE 3385 CP", "label": "3385", "hex": "#9ed4c4" }, { "name": "PANTONE 3395 CP", "label": "3395", "hex": "#51ba9a" }, { "name": "PANTONE 3405 CP", "label": "3405", "hex": "#00a272" }, { "name": "PANTONE 3415 CP", "label": "3415", "hex": "#007f4c" }, { "name": "PANTONE 3425 CP", "label": "3425", "hex": "#006640" }, { "name": "PANTONE 3435 CP", "label": "3435", "hex": "#064a33" }, { "name": "PANTONE 344 CP", "label": "344", "hex": "#bbdec2" }, { "name": "PANTONE 345 CP", "label": "345", "hex": "#a0d2ab" }, { "name": "PANTONE 346 CP", "label": "346", "hex": "#84c696" }, { "name": "PANTONE 347 CP", "label": "347", "hex": "#00993e" }, { "name": "PANTONE 348 CP", "label": "348", "hex": "#00893c" }, { "name": "PANTONE 349 CP", "label": "349", "hex": "#006c38" }, { "name": "PANTONE 350 CP", "label": "350", "hex": "#245339" }, { "name": "PANTONE 351 CP", "label": "351", "hex": "#c7e4d1" }, { "name": "PANTONE 352 CP", "label": "352", "hex": "#afd9c0" }, { "name": "PANTONE 353 CP", "label": "353", "hex": "#a5d4b6" }, { "name": "PANTONE 354 CP", "label": "354", "hex": "#00a448" }, { "name": "PANTONE 355 CP", "label": "355", "hex": "#009b3d" }, { "name": "PANTONE 356 CP", "label": "356", "hex": "#007f37" }, { "name": "PANTONE 357 CP", "label": "357", "hex": "#005331" }, { "name": "PANTONE 7478 CP", "label": "7478", "hex": "#c5e3cd" }, { "name": "PANTONE 7479 CP", "label": "7479", "hex": "#7cc287" }, { "name": "PANTONE 7480 CP", "label": "7480", "hex": "#2cad6d" }, { "name": "PANTONE 7481 CP", "label": "7481", "hex": "#00a553" }, { "name": "PANTONE 7482 CP", "label": "7482", "hex": "#009d48" }, { "name": "PANTONE 7483 CP", "label": "7483", "hex": "#1e5d39" }, { "name": "PANTONE 7484 CP", "label": "7484", "hex": "#00573d" }, { "name": "PANTONE 7730 CP", "label": "7730", "hex": "#4a9e61" }, { "name": "PANTONE 7731 CP", "label": "7731", "hex": "#1b8f45" }, { "name": "PANTONE 7732 CP", "label": "7732", "hex": "#007e3a" }, { "name": "PANTONE 7733 CP", "label": "7733", "hex": "#00703c" }, { "name": "PANTONE 7734 CP", "label": "7734", "hex": "#225d38" }, { "name": "PANTONE 7735 CP", "label": "7735", "hex": "#38563a" }, { "name": "PANTONE 7736 CP", "label": "7736", "hex": "#37523e" }, { "name": "PANTONE 7737 CP", "label": "7737", "hex": "#71ae32" }, { "name": "PANTONE 7738 CP", "label": "7738", "hex": "#3ea83a" }, { "name": "PANTONE 7739 CP", "label": "7739", "hex": "#24a141" }, { "name": "PANTONE 7740 CP", "label": "7740", "hex": "#35993d" }, { "name": "PANTONE 7741 CP", "label": "7741", "hex": "#328d34" }, { "name": "PANTONE 7742 CP", "label": "7742", "hex": "#3b742e" }, { "name": "PANTONE 7743 CP", "label": "7743", "hex": "#396d2d" }, { "name": "PANTONE 358 CP", "label": "358", "hex": "#b8daab" }, { "name": "PANTONE 359 CP", "label": "359", "hex": "#abd39a" }, { "name": "PANTONE 360 CP", "label": "360", "hex": "#6ab653" }, { "name": "PANTONE 361 CP", "label": "361", "hex": "#2fa737" }, { "name": "PANTONE 362 CP", "label": "362", "hex": "#27a438" }, { "name": "PANTONE 363 CP", "label": "363", "hex": "#329134" }, { "name": "PANTONE 364 CP", "label": "364", "hex": "#3a752e" }, { "name": "PANTONE 7485 CP", "label": "7485", "hex": "#eff4de" }, { "name": "PANTONE 7486 CP", "label": "7486", "hex": "#c8dfa5" }, { "name": "PANTONE 7487 CP", "label": "7487", "hex": "#a8cf7f" }, { "name": "PANTONE 7488 CP", "label": "7488", "hex": "#8fc154" }, { "name": "PANTONE 7489 CP", "label": "7489", "hex": "#7db65b" }, { "name": "PANTONE 7490 CP", "label": "7490", "hex": "#719d3b" }, { "name": "PANTONE 7491 CP", "label": "7491", "hex": "#728534" }, { "name": "PANTONE 365 CP", "label": "365", "hex": "#d1e3a8" }, { "name": "PANTONE 366 CP", "label": "366", "hex": "#c2db98" }, { "name": "PANTONE 367 CP", "label": "367", "hex": "#abce72" }, { "name": "PANTONE 368 CP", "label": "368", "hex": "#66b231" }, { "name": "PANTONE 369 CP", "label": "369", "hex": "#5bb033" }, { "name": "PANTONE 370 CP", "label": "370", "hex": "#5e952d" }, { "name": "PANTONE 371 CP", "label": "371", "hex": "#556729" }, { "name": "PANTONE 372 CP", "label": "372", "hex": "#e2eaaf" }, { "name": "PANTONE 373 CP", "label": "373", "hex": "#d8e4a0" }, { "name": "PANTONE 374 CP", "label": "374", "hex": "#c6d97b" }, { "name": "PANTONE 375 CP", "label": "375", "hex": "#a2c640" }, { "name": "PANTONE 376 CP", "label": "376", "hex": "#8bbd29" }, { "name": "PANTONE 377 CP", "label": "377", "hex": "#82a527" }, { "name": "PANTONE 378 CP", "label": "378", "hex": "#556328" }, { "name": "PANTONE 580 CP", "label": "580", "hex": "#d9e8b9" }, { "name": "PANTONE 579 CP", "label": "579", "hex": "#d1e3aa" }, { "name": "PANTONE 578 CP", "label": "578", "hex": "#cbdfa0" }, { "name": "PANTONE 577 CP", "label": "577", "hex": "#b9d388" }, { "name": "PANTONE 576 CP", "label": "576", "hex": "#739936" }, { "name": "PANTONE 575 CP", "label": "575", "hex": "#5d7a30" }, { "name": "PANTONE 574 CP", "label": "574", "hex": "#425028" }, { "name": "PANTONE 5807 CP", "label": "5807", "hex": "#e5e8ca" }, { "name": "PANTONE 5797 CP", "label": "5797", "hex": "#d4d7ac" }, { "name": "PANTONE 5787 CP", "label": "5787", "hex": "#cdd2a2" }, { "name": "PANTONE 5777 CP", "label": "5777", "hex": "#afb478" }, { "name": "PANTONE 5767 CP", "label": "5767", "hex": "#91954b" }, { "name": "PANTONE 5757 CP", "label": "5757", "hex": "#717530" }, { "name": "PANTONE 5747 CP", "label": "5747", "hex": "#444a26" }, { "name": "PANTONE 5875 CP", "label": "5875", "hex": "#e6e4bd" }, { "name": "PANTONE 5865 CP", "label": "5865", "hex": "#dddbab" }, { "name": "PANTONE 5855 CP", "label": "5855", "hex": "#d0cd97" }, { "name": "PANTONE 5845 CP", "label": "5845", "hex": "#b8b26e" }, { "name": "PANTONE 5835 CP", "label": "5835", "hex": "#a9a156" }, { "name": "PANTONE 5825 CP", "label": "5825", "hex": "#8b8336" }, { "name": "PANTONE 5815 CP", "label": "5815", "hex": "#524d24" }, { "name": "PANTONE 5803 CP", "label": "5803", "hex": "#d9dfc5" }, { "name": "PANTONE 5793 CP", "label": "5793", "hex": "#c7cdab" }, { "name": "PANTONE 5783 CP", "label": "5783", "hex": "#b3bb95" }, { "name": "PANTONE 5773 CP", "label": "5773", "hex": "#979e73" }, { "name": "PANTONE 5763 CP", "label": "5763", "hex": "#737b49" }, { "name": "PANTONE 5753 CP", "label": "5753", "hex": "#626b3a" }, { "name": "PANTONE 5743 CP", "label": "5743", "hex": "#434e2e" }, { "name": "PANTONE 7492 CP", "label": "7492", "hex": "#dce19f" }, { "name": "PANTONE 7493 CP", "label": "7493", "hex": "#c9d7a3" }, { "name": "PANTONE 7494 CP", "label": "7494", "hex": "#a4bd99" }, { "name": "PANTONE 7495 CP", "label": "7495", "hex": "#889a28" }, { "name": "PANTONE 7496 CP", "label": "7496", "hex": "#718526" }, { "name": "PANTONE 7497 CP", "label": "7497", "hex": "#78715b" }, { "name": "PANTONE 7498 CP", "label": "7498", "hex": "#515731" }, { "name": "PANTONE 7744 CP", "label": "7744", "hex": "#d2cd04" }, { "name": "PANTONE 7745 CP", "label": "7745", "hex": "#b6b22d" }, { "name": "PANTONE 7746 CP", "label": "7746", "hex": "#a1a034" }, { "name": "PANTONE 7747 CP", "label": "7747", "hex": "#8f9036" }, { "name": "PANTONE 7748 CP", "label": "7748", "hex": "#8a8b36" }, { "name": "PANTONE 7749 CP", "label": "7749", "hex": "#7f7c27" }, { "name": "PANTONE 7750 CP", "label": "7750", "hex": "#75712a" }, { "name": "PANTONE 379 CP", "label": "379", "hex": "#ebe981" }, { "name": "PANTONE 380 CP", "label": "380", "hex": "#e3e049" }, { "name": "PANTONE 381 CP", "label": "381", "hex": "#d5d706" }, { "name": "PANTONE 382 CP", "label": "382", "hex": "#cfd500" }, { "name": "PANTONE 383 CP", "label": "383", "hex": "#b1b714" }, { "name": "PANTONE 384 CP", "label": "384", "hex": "#9b9c1f" }, { "name": "PANTONE 385 CP", "label": "385", "hex": "#7c762a" }, { "name": "PANTONE 386 CP", "label": "386", "hex": "#f4eb74" }, { "name": "PANTONE 387 CP", "label": "387", "hex": "#efe64d" }, { "name": "PANTONE 388 CP", "label": "388", "hex": "#eae34e" }, { "name": "PANTONE 389 CP", "label": "389", "hex": "#dddd41" }, { "name": "PANTONE 390 CP", "label": "390", "hex": "#ccd000" }, { "name": "PANTONE 391 CP", "label": "391", "hex": "#a2a01a" }, { "name": "PANTONE 392 CP", "label": "392", "hex": "#888321" }, { "name": "PANTONE 587 CP", "label": "587", "hex": "#f2ee9c" }, { "name": "PANTONE 586 CP", "label": "586", "hex": "#f1ec86" }, { "name": "PANTONE 585 CP", "label": "585", "hex": "#eae670" }, { "name": "PANTONE 584 CP", "label": "584", "hex": "#dddc34" }, { "name": "PANTONE 583 CP", "label": "583", "hex": "#c3c506" }, { "name": "PANTONE 582 CP", "label": "582", "hex": "#95921e" }, { "name": "PANTONE 581 CP", "label": "581", "hex": "#615c24" }, { "name": "PANTONE 393 CP", "label": "393", "hex": "#f9f090" }, { "name": "PANTONE 394 CP", "label": "394", "hex": "#fbed62" }, { "name": "PANTONE 395 CP", "label": "395", "hex": "#f6e726" }, { "name": "PANTONE 396 CP", "label": "396", "hex": "#f4e500" }, { "name": "PANTONE 397 CP", "label": "397", "hex": "#d1c500" }, { "name": "PANTONE 398 CP", "label": "398", "hex": "#bfb208" }, { "name": "PANTONE 399 CP", "label": "399", "hex": "#a69b19" }, { "name": "PANTONE 3935 CP", "label": "3935", "hex": "#fff283" }, { "name": "PANTONE 3945 CP", "label": "3945", "hex": "#ffec1f" }, { "name": "PANTONE 3955 CP", "label": "3955", "hex": "#ffe900" }, { "name": "PANTONE 3965 CP", "label": "3965", "hex": "#fae700" }, { "name": "PANTONE 3975 CP", "label": "3975", "hex": "#c6b301" }, { "name": "PANTONE 3985 CP", "label": "3985", "hex": "#9e8d1c" }, { "name": "PANTONE 3995 CP", "label": "3995", "hex": "#685d24" }, { "name": "PANTONE 600 CP", "label": "600", "hex": "#fff7b6" }, { "name": "PANTONE 601 CP", "label": "601", "hex": "#fcf3a3" }, { "name": "PANTONE 602 CP", "label": "602", "hex": "#fbf190" }, { "name": "PANTONE 603 CP", "label": "603", "hex": "#fceb44" }, { "name": "PANTONE 604 CP", "label": "604", "hex": "#fee900" }, { "name": "PANTONE 605 CP", "label": "605", "hex": "#f4da00" }, { "name": "PANTONE 606 CP", "label": "606", "hex": "#e4c800" }, { "name": "PANTONE 607 CP", "label": "607", "hex": "#fcf6bf" }, { "name": "PANTONE 608 CP", "label": "608", "hex": "#faf3a8" }, { "name": "PANTONE 609 CP", "label": "609", "hex": "#f7ee8f" }, { "name": "PANTONE 610 CP", "label": "610", "hex": "#f3e65c" }, { "name": "PANTONE 611 CP", "label": "611", "hex": "#e6d52c" }, { "name": "PANTONE 612 CP", "label": "612", "hex": "#d2be00" }, { "name": "PANTONE 613 CP", "label": "613", "hex": "#c0a90b" }, { "name": "PANTONE 461 CP", "label": "461", "hex": "#fcf0a5" }, { "name": "PANTONE 460 CP", "label": "460", "hex": "#faeb8d" }, { "name": "PANTONE 459 CP", "label": "459", "hex": "#f3e476" }, { "name": "PANTONE 458 CP", "label": "458", "hex": "#eedb5d" }, { "name": "PANTONE 457 CP", "label": "457", "hex": "#b39319" }, { "name": "PANTONE 456 CP", "label": "456", "hex": "#9e841e" }, { "name": "PANTONE 455 CP", "label": "455", "hex": "#61512b" }, { "name": "PANTONE 614 CP", "label": "614", "hex": "#f4f0c0" }, { "name": "PANTONE 615 CP", "label": "615", "hex": "#ede7ab" }, { "name": "PANTONE 616 CP", "label": "616", "hex": "#e4dc96" }, { "name": "PANTONE 617 CP", "label": "617", "hex": "#d7cc6f" }, { "name": "PANTONE 618 CP", "label": "618", "hex": "#b8aa3c" }, { "name": "PANTONE 619 CP", "label": "619", "hex": "#a1922c" }, { "name": "PANTONE 620 CP", "label": "620", "hex": "#8f8125" }, { "name": "PANTONE 7751 CP", "label": "7751", "hex": "#dfc853" }, { "name": "PANTONE 7752 CP", "label": "7752", "hex": "#e3c231" }, { "name": "PANTONE 7753 CP", "label": "7753", "hex": "#cba822" }, { "name": "PANTONE 7754 CP", "label": "7754", "hex": "#9e8734" }, { "name": "PANTONE 7755 CP", "label": "7755", "hex": "#857539" }, { "name": "PANTONE 7756 CP", "label": "7756", "hex": "#746737" }, { "name": "PANTONE 7757 CP", "label": "7757", "hex": "#665f40" }, { "name": "PANTONE 7758 CP", "label": "7758", "hex": "#e8d300" }, { "name": "PANTONE 7759 CP", "label": "7759", "hex": "#d4c100" }, { "name": "PANTONE 7760 CP", "label": "7760", "hex": "#908125" }, { "name": "PANTONE 7761 CP", "label": "7761", "hex": "#7e7734" }, { "name": "PANTONE 7762 CP", "label": "7762", "hex": "#626639" }, { "name": "PANTONE 7763 CP", "label": "7763", "hex": "#545832" }, { "name": "PANTONE 7764 CP", "label": "7764", "hex": "#515431" }, { "name": "PANTONE 7765 CP", "label": "7765", "hex": "#cec100" }, { "name": "PANTONE 7766 CP", "label": "7766", "hex": "#c0b307" }, { "name": "PANTONE 7767 CP", "label": "7767", "hex": "#ac9b18" }, { "name": "PANTONE 7768 CP", "label": "7768", "hex": "#96853c" }, { "name": "PANTONE 7769 CP", "label": "7769", "hex": "#766731" }, { "name": "PANTONE 7770 CP", "label": "7770", "hex": "#5e5236" }, { "name": "PANTONE 7771 CP", "label": "7771", "hex": "#4e472b" }, { "name": "PANTONE 4545 CP", "label": "4545", "hex": "#efe6bf" }, { "name": "PANTONE 4535 CP", "label": "4535", "hex": "#ded3aa" }, { "name": "PANTONE 4525 CP", "label": "4525", "hex": "#cebf8b" }, { "name": "PANTONE 4515 CP", "label": "4515", "hex": "#b6a264" }, { "name": "PANTONE 4505 CP", "label": "4505", "hex": "#99803a" }, { "name": "PANTONE 4495 CP", "label": "4495", "hex": "#7f672e" }, { "name": "PANTONE 4485 CP", "label": "4485", "hex": "#594929" }, { "name": "PANTONE 454 CP", "label": "454", "hex": "#dddcbb" }, { "name": "PANTONE 453 CP", "label": "453", "hex": "#d1cca7" }, { "name": "PANTONE 452 CP", "label": "452", "hex": "#b6b287" }, { "name": "PANTONE 451 CP", "label": "451", "hex": "#a49f6f" }, { "name": "PANTONE 450 CP", "label": "450", "hex": "#544a2b" }, { "name": "PANTONE 449 CP", "label": "449", "hex": "#524831" }, { "name": "PANTONE 448 CP", "label": "448", "hex": "#473f2b" }, { "name": "PANTONE 7499 CP", "label": "7499", "hex": "#fff7d2" }, { "name": "PANTONE 7500 CP", "label": "7500", "hex": "#f7ecca" }, { "name": "PANTONE 7501 CP", "label": "7501", "hex": "#f0e1be" }, { "name": "PANTONE 7502 CP", "label": "7502", "hex": "#e5d0a4" }, { "name": "PANTONE 7503 CP", "label": "7503", "hex": "#b8a979" }, { "name": "PANTONE 7504 CP", "label": "7504", "hex": "#9c7f63" }, { "name": "PANTONE 7505 CP", "label": "7505", "hex": "#89674b" }, { "name": "PANTONE 468 CP", "label": "468", "hex": "#edd8a5" }, { "name": "PANTONE 467 CP", "label": "467", "hex": "#e1cb9c" }, { "name": "PANTONE 466 CP", "label": "466", "hex": "#d3b47f" }, { "name": "PANTONE 465 CP", "label": "465", "hex": "#c19c5d" }, { "name": "PANTONE 464 CP", "label": "464", "hex": "#87592a" }, { "name": "PANTONE 463 CP", "label": "463", "hex": "#754f28" }, { "name": "PANTONE 462 CP", "label": "462", "hex": "#594733" }, { "name": "PANTONE 7506 CP", "label": "7506", "hex": "#feedcb" }, { "name": "PANTONE 7507 CP", "label": "7507", "hex": "#ffe3b6" }, { "name": "PANTONE 7508 CP", "label": "7508", "hex": "#f3d098" }, { "name": "PANTONE 7509 CP", "label": "7509", "hex": "#edbb7c" }, { "name": "PANTONE 7510 CP", "label": "7510", "hex": "#dc9a4d" }, { "name": "PANTONE 7511 CP", "label": "7511", "hex": "#c07722" }, { "name": "PANTONE 7512 CP", "label": "7512", "hex": "#b16724" }, { "name": "PANTONE 719 CP", "label": "719", "hex": "#fce1c4" }, { "name": "PANTONE 720 CP", "label": "720", "hex": "#f7caa5" }, { "name": "PANTONE 721 CP", "label": "721", "hex": "#f1b482" }, { "name": "PANTONE 722 CP", "label": "722", "hex": "#da8a4b" }, { "name": "PANTONE 723 CP", "label": "723", "hex": "#c46d28" }, { "name": "PANTONE 724 CP", "label": "724", "hex": "#9a4e26" }, { "name": "PANTONE 725 CP", "label": "725", "hex": "#824126" }, { "name": "PANTONE 475 CP", "label": "475", "hex": "#fcd5b8" }, { "name": "PANTONE 474 CP", "label": "474", "hex": "#fbcdab" }, { "name": "PANTONE 473 CP", "label": "473", "hex": "#f9bf9a" }, { "name": "PANTONE 472 CP", "label": "472", "hex": "#f1a069" }, { "name": "PANTONE 471 CP", "label": "471", "hex": "#bc5927" }, { "name": "PANTONE 470 CP", "label": "470", "hex": "#a15128" }, { "name": "PANTONE 469 CP", "label": "469", "hex": "#5a3424" }, { "name": "PANTONE 726 CP", "label": "726", "hex": "#f5dbc1" }, { "name": "PANTONE 727 CP", "label": "727", "hex": "#edccae" }, { "name": "PANTONE 728 CP", "label": "728", "hex": "#deaf8a" }, { "name": "PANTONE 729 CP", "label": "729", "hex": "#ca8c5b" }, { "name": "PANTONE 730 CP", "label": "730", "hex": "#a76939" }, { "name": "PANTONE 731 CP", "label": "731", "hex": "#774425" }, { "name": "PANTONE 732 CP", "label": "732", "hex": "#633c24" }, { "name": "PANTONE 4685 CP", "label": "4685", "hex": "#f0d8c3" }, { "name": "PANTONE 4675 CP", "label": "4675", "hex": "#e8ccb5" }, { "name": "PANTONE 4665 CP", "label": "4665", "hex": "#dab096" }, { "name": "PANTONE 4655 CP", "label": "4655", "hex": "#c69172" }, { "name": "PANTONE 4645 CP", "label": "4645", "hex": "#af7b55" }, { "name": "PANTONE 4635 CP", "label": "4635", "hex": "#985d38" }, { "name": "PANTONE 4625 CP", "label": "4625", "hex": "#4c322a" }, { "name": "PANTONE 7513 CP", "label": "7513", "hex": "#f8ccba" }, { "name": "PANTONE 7514 CP", "label": "7514", "hex": "#e9b39d" }, { "name": "PANTONE 7515 CP", "label": "7515", "hex": "#da9a7c" }, { "name": "PANTONE 7516 CP", "label": "7516", "hex": "#a04e2e" }, { "name": "PANTONE 7517 CP", "label": "7517", "hex": "#894127" }, { "name": "PANTONE 7518 CP", "label": "7518", "hex": "#724f49" }, { "name": "PANTONE 7519 CP", "label": "7519", "hex": "#635249" }, { "name": "PANTONE 4755 CP", "label": "4755", "hex": "#e6d0c2" }, { "name": "PANTONE 4745 CP", "label": "4745", "hex": "#d8bdb1" }, { "name": "PANTONE 4735 CP", "label": "4735", "hex": "#d0afa3" }, { "name": "PANTONE 4725 CP", "label": "4725", "hex": "#ab8272" }, { "name": "PANTONE 4715 CP", "label": "4715", "hex": "#8d5a4a" }, { "name": "PANTONE 4705 CP", "label": "4705", "hex": "#714236" }, { "name": "PANTONE 4695 CP", "label": "4695", "hex": "#553024" }, { "name": "PANTONE 482 CP", "label": "482", "hex": "#e8d1c2" }, { "name": "PANTONE 481 CP", "label": "481", "hex": "#dfc1af" }, { "name": "PANTONE 480 CP", "label": "480", "hex": "#d4b09e" }, { "name": "PANTONE 479 CP", "label": "479", "hex": "#b27d66" }, { "name": "PANTONE 478 CP", "label": "478", "hex": "#703a2d" }, { "name": "PANTONE 477 CP", "label": "477", "hex": "#61382d" }, { "name": "PANTONE 476 CP", "label": "476", "hex": "#4a322a" }, { "name": "PANTONE 7527 CP", "label": "7527", "hex": "#ebe6d7" }, { "name": "PANTONE 7528 CP", "label": "7528", "hex": "#d7cdc1" }, { "name": "PANTONE 7529 CP", "label": "7529", "hex": "#c8bcb0" }, { "name": "PANTONE 7530 CP", "label": "7530", "hex": "#b1a498" }, { "name": "PANTONE 7531 CP", "label": "7531", "hex": "#847466" }, { "name": "PANTONE 7532 CP", "label": "7532", "hex": "#695a4f" }, { "name": "PANTONE 7533 CP", "label": "7533", "hex": "#43382d" }, { "name": "PANTONE 7534 CP", "label": "7534", "hex": "#e7e3d4" }, { "name": "PANTONE 7535 CP", "label": "7535", "hex": "#cac3b2" }, { "name": "PANTONE 7536 CP", "label": "7536", "hex": "#b1a994" }, { "name": "PANTONE 7537 CP", "label": "7537", "hex": "#b4bab0" }, { "name": "PANTONE 7538 CP", "label": "7538", "hex": "#9ba49a" }, { "name": "PANTONE 7539 CP", "label": "7539", "hex": "#939a98" }, { "name": "PANTONE 7540 CP", "label": "7540", "hex": "#505459" }, { "name": "PANTONE 427 CP", "label": "427", "hex": "#e3e6e6" }, { "name": "PANTONE 428 CP", "label": "428", "hex": "#d2d8db" }, { "name": "PANTONE 429 CP", "label": "429", "hex": "#aeb7bd" }, { "name": "PANTONE 430 CP", "label": "430", "hex": "#828d96" }, { "name": "PANTONE 431 CP", "label": "431", "hex": "#59656f" }, { "name": "PANTONE 432 CP", "label": "432", "hex": "#333c45" }, { "name": "PANTONE 433 CP", "label": "433", "hex": "#22282d" }, { "name": "PANTONE 420 CP", "label": "420", "hex": "#dcddd9" }, { "name": "PANTONE 421 CP", "label": "421", "hex": "#b8bcba" }, { "name": "PANTONE 422 CP", "label": "422", "hex": "#a1a5a6" }, { "name": "PANTONE 423 CP", "label": "423", "hex": "#8b8e8d" }, { "name": "PANTONE 424 CP", "label": "424", "hex": "#6c7173" }, { "name": "PANTONE 425 CP", "label": "425", "hex": "#424a4d" }, { "name": "PANTONE 426 CP", "label": "426", "hex": "#212526" }, { "name": "PANTONE 441 CP", "label": "441", "hex": "#c5d8d2" }, { "name": "PANTONE 442 CP", "label": "442", "hex": "#adbdb7" }, { "name": "PANTONE 443 CP", "label": "443", "hex": "#90a2a3" }, { "name": "PANTONE 444 CP", "label": "444", "hex": "#63797a" }, { "name": "PANTONE 445 CP", "label": "445", "hex": "#404f4f" }, { "name": "PANTONE 446 CP", "label": "446", "hex": "#37413f" }, { "name": "PANTONE 447 CP", "label": "447", "hex": "#313633" }, { "name": "PANTONE 413 CP", "label": "413", "hex": "#d4d6ce" }, { "name": "PANTONE 414 CP", "label": "414", "hex": "#b9bbb2" }, { "name": "PANTONE 415 CP", "label": "415", "hex": "#969992" }, { "name": "PANTONE 416 CP", "label": "416", "hex": "#7a7d76" }, { "name": "PANTONE 417 CP", "label": "417", "hex": "#62655d" }, { "name": "PANTONE 418 CP", "label": "418", "hex": "#51534c" }, { "name": "PANTONE 419 CP", "label": "419", "hex": "#222623" }, { "name": "PANTONE 400 CP", "label": "400", "hex": "#d6d2c9" }, { "name": "PANTONE 401 CP", "label": "401", "hex": "#bbb7af" }, { "name": "PANTONE 402 CP", "label": "402", "hex": "#a69f98" }, { "name": "PANTONE 403 CP", "label": "403", "hex": "#8c857d" }, { "name": "PANTONE 404 CP", "label": "404", "hex": "#766e67" }, { "name": "PANTONE 405 CP", "label": "405", "hex": "#5b544f" }, { "name": "PANTONE Black CP", "label": "black", "hex": "#2a2926" }, { "name": "PANTONE 406 CP", "label": "406", "hex": "#d7d1cc" }, { "name": "PANTONE 407 CP", "label": "407", "hex": "#bab2b0" }, { "name": "PANTONE 408 CP", "label": "408", "hex": "#a09693" }, { "name": "PANTONE 409 CP", "label": "409", "hex": "#867c7b" }, { "name": "PANTONE 410 CP", "label": "410", "hex": "#726564" }, { "name": "PANTONE 411 CP", "label": "411", "hex": "#534847" }, { "name": "PANTONE 412 CP", "label": "412", "hex": "#332d2d" }, { "name": "PANTONE 434 CP", "label": "434", "hex": "#ddd4d4" }, { "name": "PANTONE 435 CP", "label": "435", "hex": "#cabfc4" }, { "name": "PANTONE 436 CP", "label": "436", "hex": "#b4a4ad" }, { "name": "PANTONE 437 CP", "label": "437", "hex": "#78646d" }, { "name": "PANTONE 438 CP", "label": "438", "hex": "#493b3a" }, { "name": "PANTONE 439 CP", "label": "439", "hex": "#3a3232" }, { "name": "PANTONE 440 CP", "label": "440", "hex": "#302d2b" }, { "name": "PANTONE Warm Gray 1 CP", "label": "warm-gray-1", "hex": "#eceae7" }, { "name": "PANTONE Warm Gray 2 CP", "label": "warm-gray-2", "hex": "#dfdbd6" }, { "name": "PANTONE Warm Gray 3 CP", "label": "warm-gray-3", "hex": "#c9c3bf" }, { "name": "PANTONE Warm Gray 4 CP", "label": "warm-gray-4", "hex": "#b9b4b0" }, { "name": "PANTONE Warm Gray 5 CP", "label": "warm-gray-5", "hex": "#b0aba6" }, { "name": "PANTONE Warm Gray 6 CP", "label": "warm-gray-6", "hex": "#9f9792" }, { "name": "PANTONE Warm Gray 7 CP", "label": "warm-gray-7", "hex": "#948985" }, { "name": "PANTONE Warm Gray 8 CP", "label": "warm-gray-8", "hex": "#8a807b" }, { "name": "PANTONE Warm Gray 9 CP", "label": "warm-gray-9", "hex": "#7f716b" }, { "name": "PANTONE Warm Gray 10 CP", "label": "warm-gray-10", "hex": "#70635d" }, { "name": "PANTONE Warm Gray 11 CP", "label": "warm-gray-11", "hex": "#625650" }, { "name": "PANTONE Cool Gray 1 CP", "label": "cool-gray-1", "hex": "#e9eae9" }, { "name": "PANTONE Cool Gray 2 CP", "label": "cool-gray-2", "hex": "#e1e2e1" }, { "name": "PANTONE Cool Gray 3 CP", "label": "cool-gray-3", "hex": "#d3d4d3" }, { "name": "PANTONE Cool Gray 4 CP", "label": "cool-gray-4", "hex": "#bec1c2" }, { "name": "PANTONE Cool Gray 5 CP", "label": "cool-gray-5", "hex": "#b6b8b9" }, { "name": "PANTONE Cool Gray 6 CP", "label": "cool-gray-6", "hex": "#b1b4b6" }, { "name": "PANTONE Cool Gray 7 CP", "label": "cool-gray-7", "hex": "#95989c" }, { "name": "PANTONE Cool Gray 8 CP", "label": "cool-gray-8", "hex": "#878b8f" }, { "name": "PANTONE Cool Gray 9 CP", "label": "cool-gray-9", "hex": "#6e7175" }, { "name": "PANTONE Cool Gray 10 CP", "label": "cool-gray-10", "hex": "#575960" }, { "name": "PANTONE Cool Gray 11 CP", "label": "cool-gray-11", "hex": "#45474c" }, { "name": "PANTONE Black 2 CP", "label": "black-2", "hex": "#373426" }, { "name": "PANTONE Black 3 CP", "label": "black-3", "hex": "#262c26" }, { "name": "PANTONE Black 4 CP", "label": "black-4", "hex": "#383027" }, { "name": "PANTONE Black 5 CP", "label": "black-5", "hex": "#3f2e32" }, { "name": "PANTONE Black 6 CP", "label": "black-6", "hex": "#1f2428" }, { "name": "PANTONE Black 7 CP", "label": "black-7", "hex": "#343331" } ]
[ "thomas@ether.com.au" ]
thomas@ether.com.au
06230ecdcf31b4856ba0534b9ff9efc8622d69c9
47f172fae0a9a32c9928a0dc025f1515a6baa658
/src/data/cifar10.py
ad3546655297e66c0b6f4e65e42751971d0ef2aa
[]
no_license
flasharrow1981/cifar10_tensorflow
953fcc7f4cea2458f30db9f80f6a940156af5c1f
05df8c9818219ba213ee21ff47c822d40aa10221
refs/heads/master
2021-08-19T12:51:31.260671
2017-11-26T10:28:21
2017-11-26T10:28:21
112,076,733
1
0
null
null
null
null
UTF-8
Python
false
false
9,638
py
# coding: utf-8 # In[2]: # %load cifar10.py import pickle import numpy import random import matplotlib.pyplot as plt import platform import cv2 import os import tensorflow as tf from PIL import Image import numpy as np class Corpus: def __init__(self): #self.load_cifar10('data/CIFAR10_data') self.load_cifar10_dataset('/home/dp/down/cifar10/cifar-10-unpack/classify') #目标文件夹') self._split_train_valid(valid_rate=0.9) self.n_train = self.train_images.shape[0] self.n_valid = self.valid_images.shape[0] self.n_test = self.test_images.shape[0] def _split_train_valid(self, valid_rate=0.9): images, labels = self.train_images, self.train_labels thresh = int(images.shape[0] * valid_rate) self.train_images, self.train_labels = images[0:thresh,:,:,:], labels[0:thresh] self.valid_images, self.valid_labels = images[thresh:,:,:,:], labels[thresh:] #从分类文件夹中读取数据 def load_cifar10_dataset(self, directory): images, labels = [], [] # 读取训练集 train_dir=os.path.join(directory,'train') train_classlist=os.listdir(train_dir) filenames=list() labels=list() for classes in train_classlist: class_path=os.path.join(train_dir,classes) filelist=os.listdir(class_path) print('classname='+classes) for file in filelist: filefullName=os.path.join(class_path,file) #filenames.append(filefullName) #image_string = tf.read_file(filefullName) #image_decoded = tf.image.decode_png(image_string, channels=3) #image_resized = tf.image.resize_images(image_decoded, [32, 32]) image_decoded = Image.open(filefullName) image_decoded = np.array(image_decoded, dtype=np.uint8) # 此时已经是一个 np.array 了,可以对它进行任意处理 image_decoded.reshape(32, 32, 3) image_decoded = image_decoded.astype(float) images.append(image_decoded) #labels.append(classes) labels.append(train_classlist.index(classes)) #print(filefullName) #print(filenames,labels) training_data = list(zip(images,labels)) np.random.shuffle(training_data) images,labels = zip(*training_data) images = numpy.array(images, dtype='float') labels = numpy.array(labels, dtype='int') #print(images.shape) #print(labels.shape) self.train_images, self.train_labels = images, labels # 读取测试集 images, labels = [], [] test_dir=os.path.join(directory,'test') test_classlist=os.listdir(test_dir) filenames=list() labels=list() for classes in test_classlist: class_path=os.path.join(test_dir,classes) filelist=os.listdir(class_path) print('classname='+classes) for file in filelist: filefullName=os.path.join(class_path,file) #filenames.append(filefullName) #image_string = tf.read_file(filefullName) #image_decoded = tf.image.decode_png(image_string, channels=3) #image_resized = tf.image.resize_images(image_decoded, [32, 32]) image_decoded = Image.open(filefullName) image_decoded = np.array(image_decoded, dtype=np.uint8) # 此时已经是一个 np.array 了,可以对它进行任意处理 image_decoded.reshape(32, 32, 3) image_decoded = image_decoded.astype(float) images.append(image_decoded) #labels.append(classes) labels.append(train_classlist.index(classes)) #print(filefullName) #print(filenames,labels) test_data = list(zip(images,labels)) np.random.shuffle(test_data) images,labels = zip(*test_data) images = numpy.array(images, dtype='float') labels = numpy.array(labels, dtype='int') self.test_images, self.test_labels = images, labels # 函数的功能时将filename对应的图片文件读进来,并缩放到统一的大小 def _parse_function(filename, label): image_string = tf.read_file(filename) image_decoded = tf.image.decode_png(image_string, channels=3) image_resized = tf.image.resize_images(image_decoded, [32, 32]) #one_hot = tf.one_hot(label, 10) #one_hot = tf.one_hot(label, NUM_CLASSES) return image_resized, label #return image_resized, one_hot def load_cifar10(self, directory): # 读取训练集 images, labels = [], [] for filename in ['%s/data_batch_%d' % (directory, j) for j in range(1, 2)]:#in range(1, 6)]: with open(filename, 'rb') as fo: if 'Windows' in platform.platform(): cifar10 = pickle.load(fo, encoding='bytes') elif 'Linux' in platform.platform(): cifar10 = pickle.load(fo, encoding='bytes') for i in range(len(cifar10[b"labels"])): image = numpy.reshape(cifar10[b"data"][i], (3, 32, 32)) image = numpy.transpose(image, (1, 2, 0)) image = image.astype(float) images.append(image) labels += cifar10[b"labels"] images = numpy.array(images, dtype='float') labels = numpy.array(labels, dtype='int') self.train_images, self.train_labels = images, labels # 读取测试集 images, labels = [], [] for filename in ['%s/test_batch' % (directory)]: with open(filename, 'rb') as fo: if 'Windows' in platform.platform(): cifar10 = pickle.load(fo, encoding='bytes') elif 'Linux' in platform.platform(): cifar10 = pickle.load(fo, encoding='bytes') for i in range(len(cifar10[b"labels"])): image = numpy.reshape(cifar10[b"data"][i], (3, 32, 32)) image = numpy.transpose(image, (1, 2, 0)) image = image.astype(float) images.append(image) labels += cifar10[b"labels"] images = numpy.array(images, dtype='float') labels = numpy.array(labels, dtype='int') self.test_images, self.test_labels = images, labels def data_augmentation(self, images, mode='train', flip=False, crop=False, crop_shape=(24,24,3), whiten=False, noise=False, noise_mean=0, noise_std=0.01): # 图像切割 if crop: if mode == 'train': images = self._image_crop(images, shape=crop_shape) elif mode == 'test': images = self._image_crop_test(images, shape=crop_shape) # 图像翻转 if flip: images = self._image_flip(images) # 图像白化 if whiten: images = self._image_whitening(images) # 图像噪声 if noise: images = self._image_noise(images, mean=noise_mean, std=noise_std) return images def _image_crop(self, images, shape): # 图像切割 new_images = [] for i in range(images.shape[0]): old_image = images[i,:,:,:] left = numpy.random.randint(old_image.shape[0] - shape[0] + 1) top = numpy.random.randint(old_image.shape[1] - shape[1] + 1) new_image = old_image[left: left+shape[0], top: top+shape[1], :] new_images.append(new_image) return numpy.array(new_images) def _image_crop_test(self, images, shape): # 图像切割 new_images = [] for i in range(images.shape[0]): old_image = images[i,:,:,:] left = int((old_image.shape[0] - shape[0]) / 2) top = int((old_image.shape[1] - shape[1]) / 2) new_image = old_image[left: left+shape[0], top: top+shape[1], :] new_images.append(new_image) return numpy.array(new_images) def _image_flip(self, images): # 图像翻转 for i in range(images.shape[0]): old_image = images[i,:,:,:] if numpy.random.random() < 0.5: new_image = cv2.flip(old_image, 1) else: new_image = old_image images[i,:,:,:] = new_image return images def _image_whitening(self, images): # 图像白化 for i in range(images.shape[0]): old_image = images[i,:,:,:] new_image = (old_image - numpy.mean(old_image)) / numpy.std(old_image) images[i,:,:,:] = new_image return images def _image_noise(self, images, mean=0, std=0.01): # 图像噪声 for i in range(images.shape[0]): old_image = images[i,:,:,:] new_image = old_image for i in range(image.shape[0]): for j in range(image.shape[1]): for k in range(image.shape[2]): new_image[i, j, k] += random.gauss(mean, std) images[i,:,:,:] = new_image return images
[ "emailtocheng@sina.com" ]
emailtocheng@sina.com
0586254129352bfb36f515bc01aaa91501665f1e
1d785e0506163d2ba7746408bc4c3d365a1aa8b4
/runserver.py
8ffce111bc04b5de242bf5b025e9ac7495b3a40d
[]
no_license
vijaya22/loaners
770e0af9872dfbb39022ca9d96d3e81200f307c6
6eb479f5936afebe173ed24a8c9b94a2551a5541
refs/heads/master
2021-01-15T12:49:22.955905
2016-04-03T12:09:30
2016-04-03T12:09:30
55,423,664
0
1
null
2017-10-29T13:11:09
2016-04-04T15:41:51
CSS
UTF-8
Python
false
false
72
py
from myapp import app if __name__ == '__main__': app.run(debug=True)
[ "suyashgargsfam@gmail.com" ]
suyashgargsfam@gmail.com
e5b6511e4d3f74222c3dbd31bce3b0057939db28
0023a88840b80b0a0bded858136748343b6ac725
/muda/version.py
f5322bd12ed85650018482ee6633666c8b4c19d8
[ "ISC" ]
permissive
jatinkhilnani/muda
5b57df2dd3ced952d8b3500fc65fff5fbc64bd31
8b60b88c0597ad11b23680d1181334e4bc85ec6f
refs/heads/master
2022-11-22T23:42:06.610313
2020-07-28T18:11:51
2020-07-28T18:11:51
261,575,849
0
0
ISC
2020-05-05T20:27:15
2020-05-05T20:27:14
null
UTF-8
Python
false
false
108
py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Version info""" short_version = "0.4.1" version = "0.4.1"
[ "brian.mcfee@nyu.edu" ]
brian.mcfee@nyu.edu
4deef57a4db017517753bdb28d72ce7cb6b01c94
d4a569dcf616b7f05e53a44803e38196b436b8b9
/Thesis@3.9.1/Lib/site-packages/mypy/typeshed/stdlib/2and3/math.pyi
2988c5a0ac7e48bc4181fa8d5975f7e3ee0d0c16
[ "MIT" ]
permissive
nverbois/TFE21-232
ac3178d24939c872c02a671c0f1d8cc471af516b
7113837b5263b5c508bfc6903cb6982b48aa7ee4
refs/heads/main
2023-06-05T18:50:59.207392
2021-06-25T19:54:40
2021-06-25T19:54:40
337,691,391
0
0
null
null
null
null
UTF-8
Python
false
false
3,455
pyi
# Stubs for math # See: http://docs.python.org/2/library/math.html from typing import Tuple, Iterable, SupportsFloat, SupportsInt, overload import sys e: float pi: float if sys.version_info >= (3, 5): inf: float nan: float if sys.version_info >= (3, 6): tau: float def acos(__x: SupportsFloat) -> float: ... def acosh(__x: SupportsFloat) -> float: ... def asin(__x: SupportsFloat) -> float: ... def asinh(__x: SupportsFloat) -> float: ... def atan(__x: SupportsFloat) -> float: ... def atan2(__y: SupportsFloat, __x: SupportsFloat) -> float: ... def atanh(__x: SupportsFloat) -> float: ... if sys.version_info >= (3,): def ceil(__x: SupportsFloat) -> int: ... else: def ceil(__x: SupportsFloat) -> float: ... def copysign(__x: SupportsFloat, __y: SupportsFloat) -> float: ... def cos(__x: SupportsFloat) -> float: ... def cosh(__x: SupportsFloat) -> float: ... def degrees(__x: SupportsFloat) -> float: ... if sys.version_info >= (3, 8): def dist(__p: Iterable[SupportsFloat], __q: Iterable[SupportsFloat]) -> float: ... def erf(__x: SupportsFloat) -> float: ... def erfc(__x: SupportsFloat) -> float: ... def exp(__x: SupportsFloat) -> float: ... def expm1(__x: SupportsFloat) -> float: ... def fabs(__x: SupportsFloat) -> float: ... def factorial(__x: SupportsInt) -> int: ... if sys.version_info >= (3,): def floor(__x: SupportsFloat) -> int: ... else: def floor(__x: SupportsFloat) -> float: ... def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ... def frexp(__x: SupportsFloat) -> Tuple[float, int]: ... def fsum(__seq: Iterable[float]) -> float: ... def gamma(__x: SupportsFloat) -> float: ... if sys.version_info >= (3, 5): def gcd(__x: int, __y: int) -> int: ... if sys.version_info >= (3, 8): def hypot(*coordinates: SupportsFloat) -> float: ... else: def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ... if sys.version_info >= (3, 5): def isclose( a: SupportsFloat, b: SupportsFloat, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ... ) -> bool: ... def isinf(__x: SupportsFloat) -> bool: ... if sys.version_info >= (3,): def isfinite(__x: SupportsFloat) -> bool: ... def isnan(__x: SupportsFloat) -> bool: ... if sys.version_info >= (3, 8): def isqrt(__n: int) -> int: ... def ldexp(__x: SupportsFloat, __i: int) -> float: ... def lgamma(__x: SupportsFloat) -> float: ... def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... def log10(__x: SupportsFloat) -> float: ... def log1p(__x: SupportsFloat) -> float: ... if sys.version_info >= (3, 3): def log2(__x: SupportsFloat) -> float: ... def modf(__x: SupportsFloat) -> Tuple[float, float]: ... def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ... if sys.version_info >= (3, 8): @overload def prod(__iterable: Iterable[int], *, start: int = ...) -> int: ... # type: ignore @overload def prod( __iterable: Iterable[SupportsFloat], *, start: SupportsFloat = ... ) -> float: ... def radians(__x: SupportsFloat) -> float: ... if sys.version_info >= (3, 7): def remainder(__x: SupportsFloat, __y: SupportsFloat) -> float: ... def sin(__x: SupportsFloat) -> float: ... def sinh(__x: SupportsFloat) -> float: ... def sqrt(__x: SupportsFloat) -> float: ... def tan(__x: SupportsFloat) -> float: ... def tanh(__x: SupportsFloat) -> float: ... def trunc(__x: SupportsFloat) -> int: ...
[ "38432529+nverbois@users.noreply.github.com" ]
38432529+nverbois@users.noreply.github.com
911a53b6fafdc87fa178c71b55ed5c02fd666fbe
9123a6624cf7d327414f5a40ea6450eef835ac4d
/src/res/reset_hs.py
fdc6a184a5826c0c0b760ee51de9b9c6d2e7be0f
[ "Apache-2.0" ]
permissive
Ale-XYX/Flappe
2718876c837c32a6464bd28dc886b5918b314b75
8199a99e44722765c01ee95f13b137336b0fba57
refs/heads/master
2021-10-23T09:24:45.353423
2019-03-16T20:41:37
2019-03-16T20:41:37
null
0
0
null
null
null
null
UTF-8
Python
false
false
52
py
import pickle pickle.dump(0, open('hs.dat', 'wb'))
[ "33987596+Pygasm@users.noreply.github.com" ]
33987596+Pygasm@users.noreply.github.com
4bcbdbb6bf47f706baea36af411230deefae2a74
45a2ab312c822b6ae426122402b68f93409d7fe3
/webui-flask2/vizdoc_server.py
3890d1668fedd4c6b1a79c2a0e476fbb9fc625a4
[]
no_license
sai-r-susarla/visual-search
9e1231aa076549924435263a280855d617e93d7c
768b73233ed5c612ba575c9c65b1e0b156c118e9
refs/heads/master
2021-05-30T17:45:21.196702
2015-12-03T10:14:06
2015-12-03T10:14:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
12,229
py
import os from flask import request from os import path from flask.ext.pymongo import PyMongo from flask import * from functools import wraps import json,time from werkzeug import secure_filename #import datetime from vizdoc_config import * #import vizdoc_user #import vizdoc_anno ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif','zip']) UPLOAD_FOLDER = os.path.dirname(os.path.abspath(__name__))+'/static/images/' print UPLOAD_FOLDER app = Flask(__name__) #mongo = PyMongo(app, config_prefix='MONGO2') mongo = PyMongo(app) # connect to another MongoDB database on the same host #app.config['MONGO2_DBNAME'] = 'vizdoc_db' #mongo = PyMongo(app, config_prefix='MONGO2') def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS #using this we can create, name a book and insert any num. of img files in it and store in appropriate place.The Global "UPLOAD FOLDER" is the location where the new book will be stored. Click "Add Book" in the UI to test it. @app.route('/uploadbook', methods=['GET', 'POST']) def upload_book(): # if request.method == 'POST': uploaded_files = request.files.getlist("file[]") dirname = request.form.get("foldername",None) print (dirname) #print type(UPLOAD_FOLDER) #print type(dirname) #BASE_DIR = 'http://localhost:5000' #'/home/vtbhat/vsearch_db' #app.config['BASE_DIR'] = '/home/vtbhat/vsearch_db' if not dirname == None: abs_path = UPLOAD_FOLDER + dirname + '/' print (abs_path) if not os.path.exists(abs_path): os.mkdir(abs_path) else: return "A book with this name already exists.. Please give another name." filenames = [] for file in uploaded_files: # Check if the file is one of the allowed types/extensions if file and allowed_file(file.filename): # Make the filename safe, remove unsupported chars filename = secure_filename(file.filename) # Move the file form the temporal folder to the upload # folder we setup #file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) file.save(abs_path + filename) filenames.append(filename) # Redirect the user to the uploaded_file route, which # will basicaly show on the browser the uploaded file #return "file(s) uploaded successfully" # Load an html page with a link to each uploaded file #return redirect(url_for('uploaded_files', filename=filename)) #return redirect(url_for('dir_listing', dirname=dirname)) return render_template('uploadbook.html',filenames=filenames) #add any num. of pages(.jpg files) to an already created book. @app.route('/uploadpage', methods=['GET', 'POST']) def upload_file(): # if request.method == 'POST': uploaded_files = request.files.getlist("file[]") dirname = request.form.get("foldername",None) print (dirname) #print type(UPLOAD_FOLDER) #print type(dirname) #BASE_DIR = 'http://localhost:5000' #'/home/vtbhat/vsearch_db' #app.config['BASE_DIR'] = '/home/vtbhat/vsearch_db' filenames = [] for file in uploaded_files: # Check if the file is one of the allowed types/extensions if file and allowed_file(file.filename): # Make the filename safe, remove unsupported chars filename = secure_filename(file.filename) # Move the file form the temporal folder to the upload # folder we setup #file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) file.save(UPLOAD_FOLDER + dirname + filename) filenames.append(filename) # Redirect the user to the uploaded_file route, which # will basicaly show on the browser the uploaded file #return "file(s) uploaded successfully" # Load an html page with a link to each uploaded file #return redirect(url_for('uploaded_files', filename=filename)) #return redirect(url_for('dir_listing', dirname=dirname)) return render_template('uploadpage.html',filenames=filenames) @app.route('/upload/<filename>') def uploaded_files(filename): return send_from_directory(app.config['UPLOAD_FOLDER'], filename) #@app.route('/<path:req_path>') #def dir_listing(req_path): # BASE_DIR = ROOTDIR #'/home/vtbhat/vsearch_db' # # # Joining the base and the requested path # abs_path = os.path.join(BASE_DIR, req_path) # # # Return 404 if path doesn't exist # if not os.path.exists(abs_path): # return abort(404) # # # Check if path is a file and serve # if os.path.isfile(abs_path): # return send_file(abs_path) # # # Show directory contents # files = os.listdir(abs_path) # return render_template('files.html', files=files) app.secret_key = 'milan322' @app.route('/') def home(): return render_template('home.html') @app.route('/logged_user') def logged_home(): return render_template('hello.html') #@app.route('/welcome') #def welcome(): # return render_template('welcome.html') def login_required(test): @wraps(test) def wrap(*args, **kwargs): if 'logged_in' in session: return test(*args, **kwargs) else: flash('you need to login first!') return redirect(url_for('login')) return wrap @app.route('/logout') def logout(): session.pop('logged_in',None) flash('you were logged out !!') return redirect (url_for('login')) #This is the page which will be opened after login. @app.route('/hello') @login_required def hello(): return render_template('hello.html') @app.route('/login',methods=['GET','POST']) def login(): error = None if request.method == 'POST': if request.form['username'] !='admin' or request.form['password'] !='admin': error='Invalid Credentials, Please try again !!' else: session['logged_in']=True return redirect(url_for('hello')) return render_template('login.html',error=error) #gives the list of all json files, recursively, present in ROOTDIR @app.route('/getbooklist') def filelist(): arr=[] for root, dirs, files in os.walk(ROOTDIR): #print('Found directory: %s' % root) for file in files: if file.endswith(".json"): abspath = os.path.join(root,file) newfile = str.replace(abspath, ROOTDIR, ""); print (newfile) sendpath=newfile data=sendpath[1] # print('\t%s' % file) #converting RAW data of python array element into json files. arr.append(str(newfile)) # return '{"books":'+arr+'}' print (arr) return json.dumps(arr) jsonfile = "filelist.json" d={ "paths": "" } d['paths']=arr json.dumps(d) print (d) with open(ROOTDIR + jsonfile, 'w') as outfile: json.dump(d, outfile, sort_keys = True, indent = 4,ensure_ascii=False) # print (s'Successfully saved!') # return (d) return send_from_directory(ROOTDIR,jsonfile) #deletes annotations in mongodb provided both imagename and coordinates @app.route('/delannoimgcoord/<image>',methods=['GET','POST']) @app.route('/delannoimgcoord/<image>/<coord>',methods=['GET','POST']) def delannoimgcord(coord,image=None): mongo.db.pages.remove({"imagepath" : image, "coord": coord}) print "success" #deletes all annotations related to an image at once @app.route('/delannoimg/<image>',methods=['GET','POST']) def delannoimg(image): mongo.db.pages.remove({"imagepath" : image}) print "success" #need to be checked @app.route('/static/<path:filepath>') def getFile(filepath): print "Entered getFile" abspath = ROOTDIR + "/" + filepath print abspath return send_file(abspath) #returns the book.json showing all of it's images @app.route('/getbooks/<bookid>', methods=['GET','POST']) def getBook(bookid): print "processing " + bookid fname = PUBSTORE+"/books/"+bookid+".json" print fname return send_from_directory(PUBSTORE+"/books",bookid+".json") #saves or inserts annotations, used imagepath and coord as keys @app.route('/saveanno/<image>/<coord>/<ratings>/<name>/<text>/<comment>',methods=['GET','POST']) def sveanno(image,coord,ratings,name,text,comment): # impath = request.args.get('pagepath',type=str) # coord = request.args.get('coord',type=str) mongo.db.pages.insert( {'imagepath': image, 'coord': coord, "annotations" : { "ratings" : ratings, "name" : name, "text" : text, "comment" : comment } }, safe=True,upsert=True) #retrives only one annotation, given an imagename. @app.route('/retrieveanno/<imagename>') def retrieveanno(imagename): page = mongo.db.pages.find_one_or_404({'imagepath': imagename}) print page #updates(replaces annotations for existing keys) an annotation privided an imagepath and coordinates. can be checked using form itself @app.route('/form/<coords>',methods=['GET','POST']) @app.route('/form/<coords>/<image>',methods=['GET','POST']) def save_page(coords,image=None): if 'submit' in request.form: mongo.db.pages.update( {'imagepath': image, 'coords': coords}, {'$set': {'ratings': request.form['ratings'], 'name': request.form['name'], 'text': request.form['text'], 'com': request.form['com']}}, safe=True, upsert=True) return redirect(url_for('show_page', pagepath=pagepath)) #needs to be checked @app.route('/getpage/<page>', methods=['GET','POST']) def getpage(page): pname = PUBSTORE+"/books/"+page+".json" print pname image = request.args.get('impath',type=str) components = pname.split('/') del components[-1] extract = components[-1].split('.') basename = extract[0] extension = "_annotation.json" finaljson = basename + extension jsonpath = ROOTDIR + "/"+ '/'.join(components) + "/segments/" + basename + extension print jsonpath if path.exists(jsonpath): with open(pname) as p: bookjson=json.load(f) print "all directory files" return send_from_directory(PUBSTORE+"/books",basename+".json") @app.route('/getanno/<coord>',methods=['GET','POST']) @app.route('/getanno/<coord>/<imagepath>',methods=['GET','POST']) def getanno(coord,imagepath=None): # impath = request.args.get('imagepath',type=str) # coord = request.args.get('coord',type=str) print "getting mongodb contents" anno = mongo.db.annotations.find_one_or_404({'coord':coord,'imagepath':imagepath}) print "successful" print anno # {'ratings': request.get('ratings'), 'name': request.get('name'), # 'text': request.get('text'), 'comment': request.get('comment')}, # safe=True, upsert=True) #runs imagesegmenter to produce rectangles on cliking an image @app.route('/segment',methods=['GET','POST']) def segment(): from imagestojson import * jsonfile = jsonfile clicked_image = request.args.get('imagepath',type=str) print clicked_image dividing = clicked_image.split('/') extract = dividing[-1].split('.') imgname = extract[0] extension = "_segments.json" finaljson = extract[0]+extension jsonpath = "/static/segments/" + finaljson if not path.exists(jsonpath): rv1 = os.system("python imagestojson.py static/images/"+dividing[-1]) if rv1 == 0: print "one script is succssful" rv2 = os.system("python mainimgsegmenter.py -j static/"+jsonfile+" -b "+finaljson) else: print "file already exists" return jsonify(result=jsonpath) @app.route('/form') def form(): image = request.args.get('image') print image coords = request.args.get('coords') print coords return render_template('form.html',page=None,image=image,coords=coords) if __name__ == '__main__': import doctest doctest.testmod() app.run(debug=True) # app.run(host = '0.0.0.0',debug=True) #def getAnnotations - complete #def delAnnotation - done #def genSegments - done #def saveAllSegments - done #def delSegment
[ "sai.susarla@gmail.com" ]
sai.susarla@gmail.com
b63d322ca7aefa38272299340d05171952a16de8
f7b18d08eb75fb33d74239c98686afbed1c12d1c
/2016/california/scripts/california_election.py
e6c029d8faecb7df65de9aaa17dc9392556e9e46
[]
permissive
democracyworks/hand-collection-to-vip
af0056a3357c90db4a50e16b3c3dd313ee48b3ef
b50aea21a46f1db7865c7c5561ae1057b6cd5ecd
refs/heads/master
2022-11-20T10:27:35.191302
2022-11-10T15:33:38
2022-11-10T15:33:38
64,783,559
0
1
BSD-3-Clause
2022-08-08T14:20:45
2016-08-02T18:49:52
Python
UTF-8
Python
false
false
9,375
py
""" id, date, name, election_type, state_id, is_statewide, registration_info, absentee_ballot_info, results_uri, polling_hours, has_election_day_registration, registration_deadline, absentee_request_deadline, hours_open_id """ import datetime import csv import config from california_polling_location import PollingLocationTxt import pandas as pd class ElectionTxt(object): def __init__(self, base_df, state_feed): self.base_df = base_df self.state_feed = state_feed #print self.base_df #print state_feed def create_election_id(self, index): """Leading zeroes are added, if necessary, to maintain a consistent id length. """ if index <= 9: index_str = '000' + str(index) elif index in range(10, 100): index_str = '00' + str(index) elif index in range(100, 1000): index_str = '0' + str(index) else: index_str = str(index) return 'e' + str(index_str) def get_date(self): """#""" return '2016-11-08' def get_name(self): """#""" return "2016 General Election" def get_election_name(self): return "2016 General" def get_election_type(self): """#""" return 'federal' #def get_state_id(self): # """#""" # get state name, lower() # pass def create_state_id(self): """Creates the state_id by matching a key in the state_dict and retrieving and modifying its value. A '0' is added, if necessary, to maintain a consistent id length. """ # TODO: use fips code for key, value in config.fips_dict.iteritems(): if key == config.state.lower(): state_num = value if state_num <=9: state_num = '0' + str(state_num) else: state_num = str(state_num) return 'st' + state_num def is_statewide(self): """#""" return 'true' def registration_info(self): """#""" return '' def absentee_ballot_info(self): """#""" return '' def results_uri(self): """#""" return '' def polling_hours(self, hours): """Takes hours from polling_location.""" return hours def has_election_day_registration(self): """#""" return 'false' def registration_deadline(self, index): """Grab registration_deadline from state_feed document.""" for index, row in self.state_feed.iterrows(): if row['office_name'] == config.state: return row['registration_deadline'] else: print 'Missing value at row ' + str(index) + '.' return '' def absentee_request_deadline(self, index): """Grab ballot_request_deadline_display from state_feed document.""" for index, row in self.state_feed.iterrows(): if row['office_name'] == config.state: return row['ballot_request_deadline'] else: print 'Missing value at row ' + str(index) + '.' return '' def hours_open_id(self): """#""" return '' def build_election_txt(self): """ New columns that match the 'schedule.txt' template are inserted into the DataFrame, apply() is used to run methods that generate the values for each row of the new columns. """ self.base_df['id'] = self.base_df.apply( lambda row: self.create_election_id(row['index']), axis=1) self.base_df['date'] = self.base_df.apply( lambda row: self.get_date(), axis=1) self.base_df['name'] = self.base_df.apply( lambda row: self.get_name(), axis=1) self.base_df['election_type'] = self.base_df.apply( lambda row: self.get_election_type(), axis=1) self.base_df['state_id'] = self.base_df.apply( lambda row: self.create_state_id(), axis=1) self.base_df['is_statewide'] = self.base_df.apply( lambda row: self.is_statewide(), axis=1) self.base_df['registration_info'] = self.base_df.apply( lambda row: self.registration_info(), axis=1) self.base_df['absentee_ballot_info'] = self.base_df.apply( lambda row: self.absentee_ballot_info(), axis=1) self.base_df['results_uri'] = self.base_df.apply( lambda row: self.results_uri(), axis=1) self.base_df['polling_hours'] = self.base_df.apply( lambda row: self.polling_hours(row['hours']), axis=1) self.base_df['has_election_day_registration'] = self.base_df.apply( lambda row: self.has_election_day_registration(), axis=1) # self.base_df['registration_deadline'] = self.base_df.apply( lambda row: self.registration_deadline(row['index']), axis=1) self.base_df['absentee_request_deadline'] = self.base_df.apply( lambda row: self.absentee_request_deadline(row['index']), axis=1) self.base_df['hours_open_id'] = self.base_df.apply( lambda row: self.hours_open_id(), axis=1) #print self.base_df return self.base_df def write(self): et = self.build_election_txt() et.drop(['ocd-division', 'county', 'name', 'address_one', 'address_two', 'city', 'state', 'zip', 'start_time', 'end_time', 'start_date', 'end_date', 'appt_1', 'appt_2', 'appt_3', 'subject_to_change', 'index', 'address_line', 'directions', 'hours', 'photo_uri', 'hours_open_id', 'is_drop_box', 'is_early_voting', 'lat', 'long', 'latlng', 'source_id'], inplace=True, axis=1) cols = ["id", "date", "name", "election_type", "state_id", "is_statewide", "registration_info", 'absentee_ballot_info', 'results_uri', "polling_hours", 'has_election_day_registration', 'registration_deadline', 'absentee_request_deadline', 'hours_open_id'] et = et.reindex(columns=cols) print et et.to_csv(config.output + 'election.txt', index=False, encoding='utf-8') # send to txt file et.to_csv(config.output + 'election.csv', index=False, encoding='utf-8') # send to csv file # def write_election_txt(self): # output_path = "/home/acg/democracyworks/hand-collection-to-vip/minnesota/output/election.txt" # try: ## f = open(output_path, 'ab') # fieldnames = ['id', 'date', 'name', 'election_type', 'state_id', 'is_statewide', # 'registration_info', 'absentee_ballot_info', 'results_uri', # 'polling_hours', 'has_election_day_registration', 'registration_deadline', # 'absentee_request_deadline', 'hours_open_id'] # writer = csv.DictWriter(f, fieldnames=fieldnames) # writer.writeheader() # writer.writerow({'id': self.create_id(), # 'date': self.get_date(), # 'name': self.get_name(), # 'election_type': self.get_election_type(), # 'state_id': self.create_state_id(), # 'is_statewide': self.is_statewide(), # 'registration_info': '', # 'absentee_ballot_info': '', # 'results_uri': self.results_uri(), # 'polling_hours': '', # 'has_election_day_registration': self.has_election_day_registration(), # 'registration_deadline': self.registration_deadline(), # 'absentee_request_deadline': self.absentee_request_deadline(), # 'hours_open_id': self.hours_open_id() # }) # finally: # f.close() if __name__ == '__main__': early_voting_path = config.output + "intermediate_doc.csv" #early_voting_path = "/Users/danielgilberg/Development/hand-collection-to-vip/polling_location/polling_location_input/kansas_early_voting_info.csv" colnames = ['ocd-division', 'county', 'name', 'address_one', 'address_two', 'dirs', 'city', 'state', 'zip', 'start_time', 'end_time', 'start_date', 'end_date', 'appt_1', 'appt_2', 'appt_3', 'subject_to_change', 'index', 'address_line', 'directions', 'hours', 'photo_uri', 'hours_open_id', 'is_drop_box', 'is_early_voting', 'lat', 'long', 'latlng', 'source_id'] early_voting_df = pd.read_csv(early_voting_path, names=colnames, encoding='utf-8', skiprows=1) early_voting_df['index'] = early_voting_df.index + 1 state_feed_path = config.data_folder + "state_feed_info.csv" colnames = ['office_name', 'ocd_division', 'same_day_reg', 'election_date', 'election_name', 'registration_deadline', "registration_deadline_display", 'ballot_request_deadline', 'ballot_request_deadline_display'] state_feed_df = pd.read_csv(state_feed_path, names=colnames, encoding='utf-8', skiprows=1) state_feed_df['index'] = state_feed_df.index + 1 # print state_feed_df et = ElectionTxt(early_voting_df, state_feed_df) et.write()
[ "danielgilberg@gmail.com" ]
danielgilberg@gmail.com
a81d0fda8526c9874b884eb9b04820a627082e31
21da6cac0e7e1786dc6749ba5fc744a231c5178d
/cbt/apps.py
1ccb35ab7c2a2cc4d3924fbb872cef1d4e82d9be
[]
no_license
CodeLuminary/cbt-api-with-django
d3636d1ffdf8a022577345187ee9a8cb5119e29b
4ee77a50f533326abe0f28450d1f9e4faec33cfe
refs/heads/main
2023-09-01T06:13:55.525634
2021-11-05T14:02:40
2021-11-05T14:02:40
416,970,799
4
1
null
null
null
null
UTF-8
Python
false
false
138
py
from django.apps import AppConfig class CbtConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'cbt'
[ "victorijoni@yahoo.com" ]
victorijoni@yahoo.com
3298402de596ffc2f42925eca95072ff096b4bea
44be0786a0d3e7022b3b8d1dfb34ac84bd91c77e
/mysite/settings.py
bd91ba17a69d5753fef9a6195cf6499a32132bfc
[]
no_license
tommytang088/my-first-blog
49c9811af177117f2bdbab2104bad532177d803b
0e4243440ba1ff20dc515227a23fe381dd94b304
refs/heads/master
2016-09-13T12:15:24.645188
2016-04-29T18:20:23
2016-04-29T18:20:23
57,331,268
0
0
null
null
null
null
UTF-8
Python
false
false
3,238
py
""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.9.5. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '_mjrl+xw@t^#5kdj^7as*kju$4zzh*7lbx!6@tp879kn0d#bst' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', ] MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'mysite.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'mysite.wsgi.application' # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'America/New_York' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')
[ "tommy.tang@rbccm.com" ]
tommy.tang@rbccm.com
bfa3bf4ddd1e536eee8ccd20e64290b2565cec39
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03945/s800732169.py
5d9f0dfa4044f793cd90924fc2efff0bfe5ae8fe
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
111
py
line = list(input()) temp = line[0] cnt = 0 for c in line[1:]: if temp != c: cnt += 1 temp = c print(cnt)
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
dbea34b24e0169d9a319879a40f7625e53d7c6d2
0ce0e8ea2d4637b0825edfbe7bbd581ea2063c28
/casescms/wsgi.py
64b398c9e0334f247922062b235f2b682318057d
[]
no_license
tmusters/casescms
e6ecc96c5600f3e01a8ed2fb3cc00aa0358f9de3
6f41cd6e4709144e5ac8a375ed5a55bc561572ce
refs/heads/master
2021-01-01T06:15:25.253609
2017-07-16T20:14:35
2017-07-16T20:14:35
97,394,769
0
0
null
2017-07-16T20:14:36
2017-07-16T16:08:15
Python
UTF-8
Python
false
false
394
py
""" WSGI config for casescms project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "casescms.settings") application = get_wsgi_application()
[ "tmusters@gmail.com" ]
tmusters@gmail.com
5b0c9cf44a0fe6ae809bd608a0f229a4c1f18b66
4ce666c4ddc227a4a8afd6ebd185fc4a2fb6aed5
/API/app.py
c3b4e157e3409803fe4872285a06fbfdc4e4ae29
[]
no_license
Shrirama-Upadhya-A/Indoor_navigation_system-1
69b2fc212e44161dcc2659835450193b068c9e20
e1cb0e01cf8fe094f35faf09dd4ca235040bc68a
refs/heads/master
2022-03-21T18:10:50.830277
2019-10-21T11:13:25
2019-10-21T11:13:25
216,563,853
0
0
null
null
null
null
UTF-8
Python
false
false
3,776
py
from flask import Flask from math import sin, cos, atan2, sqrt, pi from flask import jsonify, request import googlemaps import os import pandas as pd PORT = 8000 app = Flask(__name__) r_earth = 6378 def get_distance(slat, slng, vlat, vlng): dlon = vlng - slng dlat = vlat - slat a = (sin(dlat/2))**2 + cos(slat) * cos(vlat) * (sin(dlon/2))**2 c = 2 * atan2(sqrt(a), sqrt(1-a)) distance = r_earth * c return distance @app.route('/grid_data', methods = ['POST']) def grid_data(): data_in = request.json['data'] print(data_in) latitude = request.json['data']['lat'] longitude = request.json['data']['lng'] count = 0 result_list = [] for i in range(-30, 30, 2): for j in range(-30, 30, 2): new_latitude = latitude + (i/1000 / r_earth) * (180 / pi) new_longitude = longitude + (j/1000 / r_earth) * (180 / pi) / cos(latitude * pi/180) count += 1 if new_latitude > latitude and new_longitude > longitude: quad = 1 elif new_latitude < latitude and new_longitude > longitude: quad = 2 elif new_latitude < latitude and new_longitude < longitude: quad = 3 elif new_longitude > latitude and new_longitude < longitude: quad = 4 result = { 'gid' : count, 'lat' : new_latitude, 'lng' : new_longitude, 'quad' : quad } result_list.append(result) return jsonify(result=result_list) @app.route('/grid_id', methods = ["POST"]) def grid_id(): data_in = request.json['data'] user_lat = request.json['data']['user_lat'] user_lng = request.json['data']['user_lng'] home_lat = request.json['data']['home_lat'] home_lng = request.json['data']['home_lng'] count = 0 result_list = [] for i in range(-30, 30, 2): for j in range(-30, 30, 2): new_latitude = home_lat + (i/1000 / r_earth) * (180 / pi) new_longitude = home_lng + (j/1000 / r_earth) * (180 / pi) / cos(home_lat * pi/180) count += 1 if new_latitude > home_lat and new_longitude > home_lng: quad = 1 elif new_latitude < home_lat and new_longitude > home_lng: quad = 2 elif new_latitude < home_lat and new_longitude < home_lng: quad = 3 elif new_longitude > home_lat and new_longitude < home_lng: quad = 4 result = { 'gid' : count, 'lat' : new_latitude, 'lng' : new_longitude, 'quad' : quad } result_list.append(result) get_df = pd.DataFrame(result_list) if user_lat > home_lat and user_lng > home_lng: quad = 1 elif user_lat < home_lat and user_lng > home_lng: quad = 2 elif user_lat < home_lat and user_lng < home_lng: quad = 3 elif user_lat > home_lat and user_lng < home_lng: quad = 4 user_range = get_df.loc[get_df['quad'] == quad] user_range = user_range.reset_index() user_range = user_range.drop(['index'], axis = 1) min_distance = { "gid" : 0, "distance" : 10000 } for i in range(user_range.shape[0]): slat = user_range['lat'][i] slng = user_range['lng'][i] gid = user_range['gid'][i] dist = get_distance(slat, slng, user_lat, user_lng) if min_distance['distance'] > dist: min_distance = { "gid" : gid, "distance" : dist } return jsonify(result = str(min_distance)) if __name__ == '__main__': app.run(port=PORT, debug=True)
[ "varun.muniaplle2017@vitstudent.ac.in" ]
varun.muniaplle2017@vitstudent.ac.in
19c80295cf35ec53845b2aaba74ba2f9db072b47
30645acd9cd6bc9624603789706fbf76e2ac9822
/Number Data type.py
2209d5840e04d94b26ced311e643502405b1f41d
[]
no_license
Sahil4UI/PythonNewSept2020
9ba059b2e6d94ee8a6879d603c1d1d887643bbee
6be4c6294f0df1d60fbf221c092bf3a409e94d32
refs/heads/master
2022-12-20T21:40:15.969728
2020-10-04T14:26:31
2020-10-04T14:26:31
299,897,378
0
0
null
null
null
null
UTF-8
Python
false
false
7,275
py
Python 3.7.8 (v3.7.8:4b47a5b6ba, Jun 27 2020, 04:47:50) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license()" for more information. >>> num1 = 10 >>> num2 = 7 >>> num1-num2 3 >>> num1+num2 17 >>> num1*num2 70 >>> num1/num2 1.4285714285714286 >>> #floor division >>> num1//num2 1 >>> 22/7 3.142857142857143 >>> 22//7 3 >>> 5**3 125 >>> #**->power >>> 10**3 1000 >>> 10**4 10000 >>> 22%7 1 >>> 5%2 1 >>> 10%6 4 >>> 9%6 3 >>> import math >>> math.sqrt(25) 5.0 >>> math.sqrt(3) 1.7320508075688772 >>> math.sqrt(2) 1.4142135623730951 >>> math.gcd(10,20) 10 >>> math.gcd(6,9) 3 >>> math.factorial(5) 120 >>> 5*4*3*2*1 120 >>> math.fabs(90) 90.0 >>> math.fabs(-90) 90.0 >>> math.ceil(90) 90 >>> math.ceil(90.9) 91 >>> math.ceil(90.02) 91 >>> math.ceil(78.2) 79 >>> help(math) Help on module math: NAME math MODULE REFERENCE https://docs.python.org/3.7/library/math The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above. DESCRIPTION This module provides access to the mathematical functions defined by the C standard. FUNCTIONS acos(x, /) Return the arc cosine (measured in radians) of x. acosh(x, /) Return the inverse hyperbolic cosine of x. asin(x, /) Return the arc sine (measured in radians) of x. asinh(x, /) Return the inverse hyperbolic sine of x. atan(x, /) Return the arc tangent (measured in radians) of x. atan2(y, x, /) Return the arc tangent (measured in radians) of y/x. Unlike atan(y/x), the signs of both x and y are considered. atanh(x, /) Return the inverse hyperbolic tangent of x. ceil(x, /) Return the ceiling of x as an Integral. This is the smallest integer >= x. copysign(x, y, /) Return a float with the magnitude (absolute value) of x but the sign of y. On platforms that support signed zeros, copysign(1.0, -0.0) returns -1.0. cos(x, /) Return the cosine of x (measured in radians). cosh(x, /) Return the hyperbolic cosine of x. degrees(x, /) Convert angle x from radians to degrees. erf(x, /) Error function at x. erfc(x, /) Complementary error function at x. exp(x, /) Return e raised to the power of x. expm1(x, /) Return exp(x)-1. This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x. fabs(x, /) Return the absolute value of the float x. factorial(x, /) Find x!. Raise a ValueError if x is negative or non-integral. floor(x, /) Return the floor of x as an Integral. This is the largest integer <= x. fmod(x, y, /) Return fmod(x, y), according to platform C. x % y may differ. frexp(x, /) Return the mantissa and exponent of x, as pair (m, e). m is a float and e is an int, such that x = m * 2.**e. If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0. fsum(seq, /) Return an accurate floating point sum of values in the iterable seq. Assumes IEEE-754 floating point arithmetic. gamma(x, /) Gamma function at x. gcd(x, y, /) greatest common divisor of x and y hypot(x, y, /) Return the Euclidean distance, sqrt(x*x + y*y). isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) Determine whether two floating point numbers are close in value. rel_tol maximum difference for being considered "close", relative to the magnitude of the input values abs_tol maximum difference for being considered "close", regardless of the magnitude of the input values Return True if a is close in value to b, and False otherwise. For the values to be considered close, the difference between them must be smaller than at least one of the tolerances. -inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is not close to anything, even itself. inf and -inf are only close to themselves. isfinite(x, /) Return True if x is neither an infinity nor a NaN, and False otherwise. isinf(x, /) Return True if x is a positive or negative infinity, and False otherwise. isnan(x, /) Return True if x is a NaN (not a number), and False otherwise. ldexp(x, i, /) Return x * (2**i). This is essentially the inverse of frexp(). lgamma(x, /) Natural logarithm of absolute value of Gamma function at x. log(...) log(x, [base=math.e]) Return the logarithm of x to the given base. If the base not specified, returns the natural logarithm (base e) of x. log10(x, /) Return the base 10 logarithm of x. log1p(x, /) Return the natural logarithm of 1+x (base e). The result is computed in a way which is accurate for x near zero. log2(x, /) Return the base 2 logarithm of x. modf(x, /) Return the fractional and integer parts of x. Both results carry the sign of x and are floats. pow(x, y, /) Return x**y (x to the power of y). radians(x, /) Convert angle x from degrees to radians. remainder(x, y, /) Difference between x and the closest integer multiple of y. Return x - n*y where n*y is the closest integer multiple of y. In the case where x is exactly halfway between two multiples of y, the nearest even value of n is used. The result is always exact. sin(x, /) Return the sine of x (measured in radians). sinh(x, /) Return the hyperbolic sine of x. sqrt(x, /) Return the square root of x. tan(x, /) Return the tangent of x (measured in radians). tanh(x, /) Return the hyperbolic tangent of x. trunc(x, /) Truncates the Real x to the nearest Integral toward 0. Uses the __trunc__ magic method. DATA e = 2.718281828459045 inf = inf nan = nan pi = 3.141592653589793 tau = 6.283185307179586 FILE /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so >>> math.floor(10.234242) 10 >>> 10**3 1000 >>> math.pow(10,3) 1000.0 >>> math.remainder(10,7) 3.0 >>> math.sqrt(90.87) 9.532575727472612 >>> #complex number >>> x = 1+5z SyntaxError: invalid syntax >>> x = 1+5j >>> x.real 1.0 >>> x.imag 5.0 >>> a=2+3j >>> b=1+4j >>> a+b (3+7j) >>> a-b (1-1j) >>> a*b (-10+11j) >>> a/b (0.8235294117647058-0.29411764705882354j) >>>
[ "noreply@github.com" ]
Sahil4UI.noreply@github.com
8fdc36cb05bf5f2c8b637c9259fdc760acc76965
b67efb7ac1832f2a70aa570f8025c69498a8cd71
/setup.py
a56b26ffcf01291aa8264b1ca3a35448338471e2
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
PogoHop/pgoapi-hsvr
f1513d7548075a7defd21f1018bd59afcb79d78f
b5761159e0240bbb81ef6c257fe2eb1bc1ce2d47
refs/heads/master
2021-01-12T11:17:55.334203
2016-11-05T12:48:38
2016-11-05T12:48:38
72,892,081
0
0
null
null
null
null
UTF-8
Python
false
false
652
py
#!/usr/bin/env python import os from setuptools import setup, find_packages from pip.req import parse_requirements setup_dir = os.path.dirname(os.path.realpath(__file__)) path_req = os.path.join(setup_dir, 'requirements.txt') install_reqs = parse_requirements(path_req, session=False) reqs = [str(ir.req) for ir in install_reqs] setup(name='pgoapi', author = 'tjado', description = 'Pokemon Go API lib', version = '1.1.6', url = 'https://github.com/tejado/pgoapi', download_url = "https://github.com/tejado/pgoapi/releases", packages = find_packages(), install_requires = reqs, )
[ "hoptional@gmail.com" ]
hoptional@gmail.com
abb210cef1a84d366213fcde9dcbe381d737a29d
143604a4668d4ccad1162e9ecfebe4e8839344de
/tests/util/test_price_extractor.py
33cef22074129c595c003f3b559aa682bbe7b426
[]
no_license
lzy7071/portfolio_tools
58c86f8eded670b8e1f5f0b45c8aadadc4e091c3
f688e22258e29c275e1d692b14a59d65f6e3f2a1
refs/heads/master
2020-09-06T00:30:18.364057
2020-03-11T20:26:23
2020-03-11T20:26:23
220,259,091
0
0
null
null
null
null
UTF-8
Python
false
false
789
py
import unittest from portfolio_tools.util import price_extractor import datetime as dt class TestPriceExtractor(unittest.TestCase): @classmethod def setUpClass(cls): companies = ['AAPL', 'GOOG'] cls.src = price_extractor.PriceExtractor(companies) def test_price_extractor(self): end_date_0 = dt.date(2019, 11, 6) start_date_0 = dt.date(2019, 10, 27) result_0 = self.src.get_prices(start_date_0, end_date_0) self.assertAlmostEqual(result_0.loc['2019-10-28']['AAPL'], 248.3045196533203) end_date_1 = dt.date(2019, 10, 27) start_date_1 = dt.date(2019, 10, 27) result_1 = self.src.get_prices(start_date_1, end_date_1) self.assertAlmostEqual(result_1.loc['2019-10-28']['AAPL'], 248.3045196533203)
[ "zhouyang.lian@familian.life" ]
zhouyang.lian@familian.life
8a5cbffd89ae328c913b84e3de4a409169ecddd1
86f860eab66ce0681cda293ee063e225747d113c
/Python_Collections/Sets/operations_set.py
13d74e26c0b77fbdfb1b797616826e75fc456587
[]
no_license
tkj5008/Luminar_Python_Programs
a1e7b85ad2b7537081bdedad3a5a4a2d9f6c1f07
d47ef0c44d5811e7039e62938a90a1de0fe7977b
refs/heads/master
2023-08-03T05:15:04.963129
2021-09-23T14:33:21
2021-09-23T14:33:21
403,316,476
0
0
null
null
null
null
UTF-8
Python
false
false
144
py
#1union #2Intersection #3Difference a={1,2,3,4,5,6,7,8,9} b={3,5,4,6,7,8,9,10} print(a.union(b)) print(a.intersection(b)) print(a.difference(b))
[ "thomas@gmail.com" ]
thomas@gmail.com
ebe439ef72b5d614dd23234e7bcadf7d5fe6285a
1d474eff74e7b83bc2fd4a52bdcb47cd1eb906d4
/library/graph.py
a8916f44b2c28f94a9c793220de77b61bdbab2a7
[]
no_license
spirosmastorakis/FSP_Engine
4d7a5cbc495dfee8268e8e9e3bd8496cf2b74ecc
be06e767151babf3c9d02681770d54aa5543a646
refs/heads/master
2021-01-23T10:00:35.327934
2014-05-14T15:13:36
2014-05-14T15:13:36
19,502,402
3
2
null
null
null
null
UTF-8
Python
false
false
4,456
py
#!/usr/bin/env python ''' Library functions for working w/graphs that are not specific to an algorithm. ''' import logging import networkx as nx lg = logging.getLogger("cc") def flatten(paths): '''Compute and return flattened graph, given paths. By flattened graph, we mean one created from the union of a set of paths. @param paths: paths to flatten @return flattened: flattened NetworkX Graph ''' used = nx.Graph() lg.debug("paths: %s" % paths) for path in paths.values(): lg.debug("flattening path: %s" % path) used.add_path(path) return used def loop_graph(n): '''Return loop graph with n nodes.''' g = nx.path_graph(n) # Add loop edge g.add_edge(g.number_of_nodes() - 1, 0) return g def set_unit_weights(g): '''Set edge weights for NetworkX graph to 1 & return.''' set_weights(g, 1.0) def set_weights(g, weight): '''Set edge weights for NetworkX graph to specified weight & return.''' for src, dst in g.edges(): g[src][dst]['weight'] = weight return g def nx_graph_from_tuples(undir_tuples, dir_tuples = None): g = nx.Graph() for a, b, w in undir_tuples: g.add_edge(a, b, weight = w) if dir_tuples: g = nx.DiGraph(g) for a, b, w in dir_tuples: g.add_edge(a, b, weight = w) return g def vertex_disjoint(paths): '''Check if provided paths are vertex-disjoint. @param paths: list of path lists ''' vertices = set([]) for path in paths: for n in path: if n in vertices: return False vertices.add(n) return True def edge_disjoint(paths): '''Check if provided paths are edge-disjoint. @param paths: list of path lists ''' edges = set([]) # Ensure edge disjointness for path in paths: for i, n in enumerate(path): if i != len(path) - 1: e = (n, path[i + 1]) if e in edges: return False edges.add(e) e_rev = (path[i + 1], n) if e_rev in edges: return False edges.add(e_rev) return True def pathlen(g, path): '''Return sum of path weights. @param g: NetworkX Graph @param path: list of nodes @return length: sum of path weights ''' pathlen = 0 for i, n in enumerate(path): if i != len(path) - 1: pathlen += g[n][path[i+1]]['weight'] return pathlen def edges_on_path(l): '''Return list of edges on a path list.''' return [(l[i], l[i + 1]) for i in range(len(l) - 1)] def interlacing_edges(list1, list2): '''Return edges in common between two paths. Input paths are considered interlacing, even if they go in the opposite direction across the same link. In that case, a single edge will be return in whatever order NetworkX prefers for an undirected edge. ''' l1 = edges_on_path(list1) l1.extend(edges_on_path([i for i in reversed(list1)])) l2 = edges_on_path(list2) l2.extend(edges_on_path([i for i in reversed(list2)])) combined = [e for e in l1 if e in l2] return nx.Graph(combined).edges() def flip_and_negate_path(g, path): '''Return new directed graph with the given path flipped & negated. @param g: NetworkX Graph (undirected) @param path: list of nodes in path @return g2: NetworkX DiGraph, modified ''' g2 = nx.DiGraph(g) for i, n in enumerate(path): if i != len(path) - 1: n_next = path[i + 1] # Remove forward edge, leaving only reverse edge. g2.remove_edge(n, n_next) # Flip edge weight to negative of the original edge.. g2[n_next][n]['weight'] *= -1 return g2 def remove_edge_bidir(g, src, dst): '''Remove edge plus one in opposite direction. @param g: NetworkX DiGraph @param src: source node @param dst: destination node ''' g.remove_edge(src, dst) g.remove_edge(dst, src) def add_edge_bidir(g, src, dst, weight = None): '''Add edge plus one in opposite direction. @param g: NetworkX DiGraph @param src: source node @param dst: destination node @param weight: optional weight to set for both ''' g.add_edge(src, dst) g.add_edge(dst, src) if weight: g[src][dst]['weight'] = weight g[dst][src]['weight'] = weight
[ "spiros.mastorakis@gmail.com" ]
spiros.mastorakis@gmail.com
d484570a7c3dc8fd04ecadb2edb816aaf3e2f4fd
aee507b29648fa3f05eaab130d04e7c03f24448c
/Task1.py
b88d6187fe2037f3ade2b220007fd0227b8edaa6
[]
no_license
AkshadK7/Advanced_Programming_Python
e319fa83d361e71c507add3e9ca1a815c8754f5d
16cfff53ecae5b7d91d9d0b4100c1f4904ecb30d
refs/heads/main
2023-04-03T02:20:12.549956
2021-04-07T07:03:07
2021-04-07T07:03:07
336,991,398
1
0
null
null
null
null
UTF-8
Python
false
false
456
py
""" Q] Using a for loop, print a table of powers of x, where x ranges from 1 to 10. For each value x, print the quantity x, x^2 and x^3 . Using tab characters in your print statement to make the values line up nicely. """ # Program : # Iterate 10 times from x = 1 to 10 for x in range(1, 11): print( "For value of x : ", x) print(x, '^', 2, '=', x**2) print(x, '^', 3, '=', x**3) print("\t") # Copyright © 2020 by Akshad Kolhatkar
[ "noreply@github.com" ]
AkshadK7.noreply@github.com
8e7a504cb3086bd4ccec033b8f92e9008b8f392a
aea8fea216234fd48269e4a1830b345c52d85de2
/fhir/resources/DSTU2/tests/test_healthcareservice.py
54d52d232e42e533c559cbf4f0677d3b24adfda6
[ "BSD-3-Clause" ]
permissive
mmabey/fhir.resources
67fce95c6b35bfdc3cbbc8036e02c962a6a7340c
cc73718e9762c04726cd7de240c8f2dd5313cbe1
refs/heads/master
2023-04-12T15:50:30.104992
2020-04-11T17:21:36
2020-04-11T17:21:36
269,712,884
0
0
NOASSERTION
2020-06-05T17:03:04
2020-06-05T17:03:04
null
UTF-8
Python
false
false
6,521
py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 1.0.2.7202 on 2019-05-14. # 2019, SMART Health IT. import io import json import os import unittest from . import healthcareservice from .fhirdate import FHIRDate class HealthcareServiceTests(unittest.TestCase): def instantiate_from(self, filename): datadir = os.environ.get("FHIR_UNITTEST_DATADIR") or "" with io.open(os.path.join(datadir, filename), "r", encoding="utf-8") as handle: js = json.load(handle) self.assertEqual("HealthcareService", js["resourceType"]) return healthcareservice.HealthcareService(js) def testHealthcareService1(self): inst = self.instantiate_from("healthcareservice-example.json") self.assertIsNotNone( inst, "Must have instantiated a HealthcareService instance" ) self.implHealthcareService1(inst) js = inst.as_json() self.assertEqual("HealthcareService", js["resourceType"]) inst2 = healthcareservice.HealthcareService(js) self.implHealthcareService1(inst2) def implHealthcareService1(self, inst): self.assertFalse(inst.appointmentRequired) self.assertEqual( inst.availabilityExceptions, "Reduced capacity is available during the Christmas period", ) self.assertEqual( inst.availableTime[0].availableEndTime.date, FHIRDate("05:30:00").date ) self.assertEqual(inst.availableTime[0].availableEndTime.as_json(), "05:30:00") self.assertEqual( inst.availableTime[0].availableStartTime.date, FHIRDate("08:30:00").date ) self.assertEqual(inst.availableTime[0].availableStartTime.as_json(), "08:30:00") self.assertEqual(inst.availableTime[0].daysOfWeek[0], "mon") self.assertEqual(inst.availableTime[0].daysOfWeek[1], "tue") self.assertEqual(inst.availableTime[0].daysOfWeek[2], "wed") self.assertEqual(inst.availableTime[0].daysOfWeek[3], "thu") self.assertEqual(inst.availableTime[0].daysOfWeek[4], "fri") self.assertEqual( inst.availableTime[1].availableEndTime.date, FHIRDate("04:30:00").date ) self.assertEqual(inst.availableTime[1].availableEndTime.as_json(), "04:30:00") self.assertEqual( inst.availableTime[1].availableStartTime.date, FHIRDate("09:30:00").date ) self.assertEqual(inst.availableTime[1].availableStartTime.as_json(), "09:30:00") self.assertEqual(inst.availableTime[1].daysOfWeek[0], "sat") self.assertEqual(inst.availableTime[1].daysOfWeek[1], "fri") self.assertEqual(inst.characteristic[0].coding[0].display, "Wheelchair access") self.assertEqual( inst.comment, "Providing Specialist psychology services to the greater Den Burg area, many years of experience dealing with PTSD issues", ) self.assertEqual(inst.contained[0].id, "DenBurg") self.assertEqual(inst.eligibility.coding[0].display, "DVA Required") self.assertEqual( inst.eligibilityNote, "Evidence of application for DVA status may be sufficient for commencing assessment", ) self.assertEqual(inst.id, "example") self.assertEqual(inst.notAvailable[0].description, "Christmas/Boxing Day") self.assertEqual( inst.notAvailable[0].during.end.date, FHIRDate("2015-12-26").date ) self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2015-12-26") self.assertEqual( inst.notAvailable[0].during.start.date, FHIRDate("2015-12-25").date ) self.assertEqual(inst.notAvailable[0].during.start.as_json(), "2015-12-25") self.assertEqual(inst.notAvailable[1].description, "New Years Day") self.assertEqual( inst.notAvailable[1].during.end.date, FHIRDate("2016-01-01").date ) self.assertEqual(inst.notAvailable[1].during.end.as_json(), "2016-01-01") self.assertEqual( inst.notAvailable[1].during.start.date, FHIRDate("2016-01-01").date ) self.assertEqual(inst.notAvailable[1].during.start.as_json(), "2016-01-01") self.assertEqual(inst.programName[0], "PTSD outreach") self.assertEqual( inst.publicKey, "*** Base64 public key goes here to be used for secure messaging ***", ) self.assertEqual(inst.referralMethod[0].coding[0].code, "phone") self.assertEqual(inst.referralMethod[0].coding[0].display, "Phone") self.assertEqual(inst.referralMethod[1].coding[0].code, "fax") self.assertEqual(inst.referralMethod[1].coding[0].display, "Fax") self.assertEqual(inst.referralMethod[2].coding[0].code, "elec") self.assertEqual(inst.referralMethod[2].coding[0].display, "Secure Messaging") self.assertEqual(inst.referralMethod[3].coding[0].code, "semail") self.assertEqual(inst.referralMethod[3].coding[0].display, "Secure Email") self.assertEqual( inst.serviceName, "Consulting psychologists and/or psychology services" ) self.assertEqual(inst.serviceType[0].type.coding[0].code, "394913002") self.assertEqual(inst.serviceType[0].type.coding[0].display, "Psychotherapy") self.assertEqual( inst.serviceType[0].type.coding[0].system, "http://snomed.info/sct" ) self.assertEqual(inst.serviceType[1].specialty[0].coding[0].code, "47505003") self.assertEqual( inst.serviceType[1].specialty[0].coding[0].display, "Posttraumatic stress disorder", ) self.assertEqual( inst.serviceType[1].specialty[0].coding[0].system, "http://snomed.info/sct" ) self.assertEqual(inst.serviceType[1].type.coding[0].code, "394587001") self.assertEqual(inst.serviceType[1].type.coding[0].display, "Psychiatry") self.assertEqual( inst.serviceType[1].type.coding[0].system, "http://snomed.info/sct" ) self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") self.assertEqual(inst.telecom[0].value, "(555) silent") self.assertEqual(inst.telecom[1].system, "email") self.assertEqual(inst.telecom[1].use, "work") self.assertEqual(inst.telecom[1].value, "directaddress@example.com") self.assertEqual(inst.text.status, "generated")
[ "connect2nazrul@gmail.com" ]
connect2nazrul@gmail.com
2eae2bccc3471614f6e26c9a445bc3a0e63bd35d
92d8db95c71bbf851a2fed6c909bbf5dc3967e9c
/activity/views.py
21f687581bbee4a7f1cc1fb9102ec8317ac17e85
[]
no_license
HuShuai666/test
68a77ea23bcf1f20d7a56e0f5fc8ae182bb30016
9d9cc50acf2f9e48f6a62b478a55bd01a0b0c0fb
refs/heads/master
2020-04-01T10:39:40.469584
2018-10-15T15:41:25
2018-10-15T15:41:25
153,126,100
0
0
null
null
null
null
UTF-8
Python
false
false
4,137
py
import uuid from rest_framework.response import Response from rest_framework.views import APIView from activity.models import Activity, Coupon, Notice from activity.serializers import ActivitySerializer, NoticeSerializer from rest_framework import exceptions, serializers from authentication.models import User from common.NewCornType import NewCornType from register.models import Register, NewCornRecord from common.execute_sql import dict_fetchall import logging logger = logging.getLogger('django') class ActivityView(APIView): def get(self, request): params = request.query_params if not params.get('name'): raise exceptions.ValidationError('参数name(活动名称)不能为空') activity = Activity.objects.filter(name=params.get('name')) if not activity: raise exceptions.ValidationError('未查询到当前活动信息') serializer = ActivitySerializer(activity[0]) result = serializer.data # 查询报名表中报名人数 user_count = Register.objects.filter(activity=1).count() result['user_count'] = user_count return Response(result) class ActivityStartAtView(APIView): def get(self, request): params = request.query_params if not params.get('name'): raise exceptions.ValidationError('参数name(活动名称)不能为空') activity = Activity.objects.filter(name=params.get('name')) if not activity: raise exceptions.ValidationError('未查询到当前活动信息') serializer = ActivitySerializer(activity[0]) result = serializer.data return Response(result['start_at']) class CornView(APIView): def get(self, request): params = request.query_params other_open_id = params.get('other_open_id') nickname = params.get('nickname') logger.info('*' * 70) logger.info(params) logger.info('*' * 70) # 获取邀请码 coupon = params.get('coupon') if not all((coupon, other_open_id, nickname)): raise serializers.ValidationError('参数(coupon, other_open_id, nickname)均不能为空') coupon = Coupon.objects.filter(code=coupon).first() if not coupon: raise serializers.ValidationError('您的优惠券码无效哦') user = User.objects.filter(nick_name=nickname).first() if not user: raise serializers.ValidationError('您还未报名参加CP活动馆哦') new_corn_record = NewCornRecord.objects.filter(operation=NewCornType.ACTIVITY_DONATE.value, other_open_id=other_open_id, nickname=nickname, coupon=coupon.code).first() if new_corn_record: raise serializers.ValidationError('您已使用过优惠券哦') balance_record = NewCornRecord.objects.filter(user_id=user.open_id).latest('create_at') NewCornRecord.objects.create(id=str(uuid.uuid4()), user_id=user.open_id, operation=NewCornType.ACTIVITY_DONATE.value, corn=coupon.corn, balance=balance_record.balance + coupon.corn, extra='优惠券' + coupon.code + '赠送', other_open_id=other_open_id, nickname=nickname, coupon=coupon.code) return Response('优惠券使用成功,您已成功获得' + str(coupon.corn) + 'New币') class NoticeView(APIView): def get(self, request): params = request.query_params notice_id = params.get('notice_id') if not notice_id: raise serializers.ValidationError('参数notice_id不能为空') notice = Notice.objects.filter(id=notice_id).first() return Response(NoticeSerializer(notice).data) class TestView(APIView): def get(self, request): sql = 'SELECT invitee,COUNT(*) as number from invitation GROUP BY invitee' result = dict_fetchall(sql) print(result) return Response(result)
[ "2313153604@qq.com" ]
2313153604@qq.com
cfe6fab25c27790ec99d7f067e35d953cc60db87
0b7c51035767007871302df94215ff56e6d10447
/assessment/views.py
f59f80ed5fc82e35bd3befb5c3ccfd09e748796a
[]
no_license
judeakinwale/sms-lotus
d6c60f99fab55d040779f0255796e89a02465512
96bc60212066946cac247f5142f0bc44988372a1
refs/heads/master
2023-07-06T10:44:37.601515
2021-08-06T10:34:52
2021-08-06T10:34:52
379,289,006
0
0
null
null
null
null
UTF-8
Python
false
false
1,704
py
from django.shortcuts import render from rest_framework import viewsets, permissions from assessment import models, serializers # Create your views here. class QuizViewSet(viewsets.ModelViewSet): queryset = models.Quiz.objects.all() serializer_class = serializers.QuizSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser] def perform_create(self, serializer): return serializer.save(supervisor=self.request.user) class QuestionViewSet(viewsets.ModelViewSet): queryset = models.Question.objects.all() serializer_class = serializers.QuestionSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser] class AnswerViewSet(viewsets.ModelViewSet): queryset = models.Answer.objects.all() serializer_class = serializers.AnswerSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser] class QuizTakerViewSet(viewsets.ModelViewSet): queryset = models.QuizTaker.objects.all() serializer_class = serializers.QuizTakerSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser] def perform_create(self, serializer): return serializer.save(student=self.request.user) class ResponseViewSet(viewsets.ModelViewSet): queryset = models.Response.objects.all() serializer_class = serializers.ResponseSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser] class GradeViewSet(viewsets.ModelViewSet): queryset = models.Grade.objects.all() serializer_class = serializers.GradeSerializer permission_classes = [permissions.IsAuthenticated | permissions.IsAdminUser]
[ "judeakinwale@gmail.com" ]
judeakinwale@gmail.com
b61e98b1e283ec7cc661c9f391b485c013e7a4b8
249a27b7617ca6eb3858016e63d1d9b4a8de1bff
/Script/Scanner de portas.py
a9b0e95d4ea55d399d54626b51bb00284c822869
[ "MIT" ]
permissive
Samio-Santos/Scanner-de-portas
634ef8c8574df7ff1be44c49c6a09399ace65720
16989150d4a618cd231a8d42513e2d7f6c369b84
refs/heads/master
2022-12-17T09:45:33.975707
2020-09-25T12:13:28
2020-09-25T12:13:28
298,557,240
0
0
null
null
null
null
UTF-8
Python
false
false
826
py
import socket # Este script faz uma varredura e verifica quais portas estão abertas na rede. def portscan(porta): # Inserir o endereço ip local, por exemplo: target = '192.168.0.1' try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) scann = sock.connect_ex((target, porta)) if scann == 0: print(f'A porta {porta} está aberta!') sock.close() else: print(f'A porta {porta} está fechada!') except: return False # Parametros para iniciar a varredura. inicio = int(input('Porta inicial: ')) fim = int(input('Porta Final: ')) # Percorre todas as portas indicadas e mostra quais estão abertas e fechadas. # chama a funcão PORTSCAN e inicia o procedimento. for port in range(inicio, fim): result = portscan(port)
[ "71763791+Samio-Santos@users.noreply.github.com" ]
71763791+Samio-Santos@users.noreply.github.com
3f2de76a80d22d0304eed9ec2ccc9329b56d3957
440c2f17a64b718227bbc9ac1f799630d0f3233d
/Chapter05_Tree&Recurison/leetcode104.py
c600ee29ff408abb6aacab4d442a1c91352b07b3
[]
no_license
HuichuanLI/alogritme-interview
6fc84fdbfe1123c1e587eaf2df6b6e9fb2ca7dda
0ac672a1582707fcaa6b6ad1f2a1d927034447df
refs/heads/master
2023-02-05T03:29:14.458783
2020-12-25T14:04:17
2020-12-25T14:04:17
206,583,220
1
0
null
null
null
null
UTF-8
Python
false
false
379
py
# class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def maxDepth(self, root): """ :type root: TreeNode :rtype: int """ if not root: return 0 return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1
[ "lhc14124908@163.com" ]
lhc14124908@163.com
9f7e1de8ee9ed5cd715f59c8bd334aafe1daa5e5
c302d680691695ee1de91ff4c32d554b66ad39ee
/api/delete/deleteItem.py
fd6cef881b3b9c33c33d9b6b4f9abfbd83a98b5a
[]
no_license
abdullah-ezzat/pycommerce
11e6aefa026ac5c154de2ac667930103b66bcd6d
1acbd4a94c89c1001751c031992dbca6f921e83f
refs/heads/master
2023-08-16T12:33:04.370271
2023-08-14T12:02:30
2023-08-14T12:02:30
364,235,542
0
0
null
null
null
null
UTF-8
Python
false
false
579
py
from django.views.decorators.csrf import csrf_exempt from abc import ABC, abstractmethod from django.http.response import JsonResponse from PyCommerce.models import cartTransactions class IDeleteCartItem(ABC): @abstractmethod def delete_cart_item(): pass class DeleteCartItem(): @csrf_exempt def delete_cart_item(self, request, id): if request.method == "DELETE": cartTransactions.objects.filter(id=id).delete() return JsonResponse('Deleted Successfully', safe=False) delete_cart_item = DeleteCartItem().delete_cart_item
[ "abdullahmohamedezzat21@gmail.com" ]
abdullahmohamedezzat21@gmail.com
f486c3b5e7cc5cacf8cda0420dc58fb8424142cd
2975a9701876253807ea0c05bf84acd07375a6bb
/core/tests.py
f2a59a5ec6197aa96aea57e9f69e8e4f9496699f
[]
no_license
NeOneSoft/BackEndMusicaAPI
c8268b5e9825e4e62a4c3a59f760e5c75834fc93
84f6cb778d2779d06f665c7b3a1d9a3281160ab3
refs/heads/master
2020-09-16T02:42:08.381383
2019-11-28T03:26:32
2019-11-28T03:26:32
223,624,541
0
0
null
null
null
null
UTF-8
Python
false
false
1,596
py
from django.contrib.auth.models import User from rest_framework.test import APITestCase class TokenTestCase(APITestCase): def setUp(self): self.user = User.objects.create_user(username='admin', password='admin', email='admin@gmail.com') def test_authenticate(self): result = self.client.post('/api/token/', {'username': 'admin', 'password': 'admin'}) assert 'access' in result.data def test_valid_token(self): result = self.client.post('/api/token/', {'username': 'admin', 'password': 'admin'}) token = result.data['access'] canciones_result = self.client.get('/api/v1/canciones/', HTTP_AUTHORIZATION='Bearer ' + token) artistas_result = self.client.get('/api/v1/artistas/', HTTP_AUTHORIZATION='Bearer ' + token) albumes_result = self.client.get('/api/v1/albumes/', HTTP_AUTHORIZATION='Bearer ' + token) assert canciones_result.status_code, artistas_result == 200 assert albumes_result.status_code == 200 def test_valid_token(self): result = self.client.post('/api/token/', {'username': 'admin', 'password': 'admin'}) token = result.data['access'] canciones_result = self.client.get('/api/v1/canciones/', HTTP_AUTHORIZATION='Bearer ' + token) artistas_result = self.client.get('/api/v1/artistas/', HTTP_AUTHORIZATION='Bearer ' + token) albumes_result = self.client.get('/api/v1/albumes/', HTTP_AUTHORIZATION='Bearer ' + token) assert canciones_result, artistas_result.status_code == 200 assert albumes_result.status_code == 200
[ "gonclapton@hotmail.com" ]
gonclapton@hotmail.com
c695b8c93d0f33cd8389af9d4481160cd350534f
266f2f192f87d908edd004e8c6b25f97e0262953
/.parts/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
d9bbfdaf2314426a58e3ca262531c4db075c35ce
[]
no_license
jnbishop/XTOL
80578d6b014699c4925a72b2c94082bd75faa74a
78ea7bb1f6f5b89724f36e325e7cd33d852a33b6
refs/heads/master
2020-04-01T18:42:04.636127
2015-02-16T06:04:19
2015-02-16T06:04:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
121
py
/home/action/.parts/packages/nodejs/0.10.35/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
[ "georgeavidon@optonline.net" ]
georgeavidon@optonline.net
4aee57ad10d37198d7d95147c0fef7f2a6ecd32b
48e124e97cc776feb0ad6d17b9ef1dfa24e2e474
/sdk/python/pulumi_azure_native/dbforpostgresql/v20210410privatepreview/get_firewall_rule.py
f871372b76ea0ee2e5bf9e82f4b45c99f9d34b68
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
bpkgoud/pulumi-azure-native
0817502630062efbc35134410c4a784b61a4736d
a3215fe1b87fba69294f248017b1591767c2b96c
refs/heads/master
2023-08-29T22:39:49.984212
2021-11-15T12:43:41
2021-11-15T12:43:41
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,111
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** 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, Sequence, Union, overload from ... import _utilities __all__ = [ 'GetFirewallRuleResult', 'AwaitableGetFirewallRuleResult', 'get_firewall_rule', 'get_firewall_rule_output', ] @pulumi.output_type class GetFirewallRuleResult: """ Represents a server firewall rule. """ def __init__(__self__, end_ip_address=None, id=None, name=None, start_ip_address=None, type=None): if end_ip_address and not isinstance(end_ip_address, str): raise TypeError("Expected argument 'end_ip_address' to be a str") pulumi.set(__self__, "end_ip_address", end_ip_address) if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") pulumi.set(__self__, "id", id) if name and not isinstance(name, str): raise TypeError("Expected argument 'name' to be a str") pulumi.set(__self__, "name", name) if start_ip_address and not isinstance(start_ip_address, str): raise TypeError("Expected argument 'start_ip_address' to be a str") pulumi.set(__self__, "start_ip_address", start_ip_address) if type and not isinstance(type, str): raise TypeError("Expected argument 'type' to be a str") pulumi.set(__self__, "type", type) @property @pulumi.getter(name="endIpAddress") def end_ip_address(self) -> str: """ The end IP address of the server firewall rule. Must be IPv4 format. """ return pulumi.get(self, "end_ip_address") @property @pulumi.getter def id(self) -> str: """ Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} """ return pulumi.get(self, "id") @property @pulumi.getter def name(self) -> str: """ The name of the resource """ return pulumi.get(self, "name") @property @pulumi.getter(name="startIpAddress") def start_ip_address(self) -> str: """ The start IP address of the server firewall rule. Must be IPv4 format. """ return pulumi.get(self, "start_ip_address") @property @pulumi.getter def type(self) -> str: """ The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" """ return pulumi.get(self, "type") class AwaitableGetFirewallRuleResult(GetFirewallRuleResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetFirewallRuleResult( end_ip_address=self.end_ip_address, id=self.id, name=self.name, start_ip_address=self.start_ip_address, type=self.type) def get_firewall_rule(firewall_rule_name: Optional[str] = None, resource_group_name: Optional[str] = None, server_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetFirewallRuleResult: """ Represents a server firewall rule. :param str firewall_rule_name: The name of the server firewall rule. :param str resource_group_name: The name of the resource group. The name is case insensitive. :param str server_name: The name of the server. """ __args__ = dict() __args__['firewallRuleName'] = firewall_rule_name __args__['resourceGroupName'] = resource_group_name __args__['serverName'] = server_name if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-native:dbforpostgresql/v20210410privatepreview:getFirewallRule', __args__, opts=opts, typ=GetFirewallRuleResult).value return AwaitableGetFirewallRuleResult( end_ip_address=__ret__.end_ip_address, id=__ret__.id, name=__ret__.name, start_ip_address=__ret__.start_ip_address, type=__ret__.type) @_utilities.lift_output_func(get_firewall_rule) def get_firewall_rule_output(firewall_rule_name: Optional[pulumi.Input[str]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, server_name: Optional[pulumi.Input[str]] = None, opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetFirewallRuleResult]: """ Represents a server firewall rule. :param str firewall_rule_name: The name of the server firewall rule. :param str resource_group_name: The name of the resource group. The name is case insensitive. :param str server_name: The name of the server. """ ...
[ "noreply@github.com" ]
bpkgoud.noreply@github.com
d9a54f9de4ed2a12a022dcf1a3a8cdd5df4601ff
d512ad00318ec1e06f58551adf678be372e59d3a
/File_Controller_Tools(Python)/Example_Code/Day1/File_Remove.py
e56d55c1a556d11ca93540c3ed19920493b775ba
[]
no_license
john911120/Java_ToyProject
aeb337f16cfd06b755fcd1b3d67ad3a68d6f4352
71c17a6edc4836257d9b72954742c80746c88046
refs/heads/master
2022-11-18T04:53:41.278766
2020-07-18T07:08:39
2020-07-18T07:08:39
270,526,236
0
0
null
null
null
null
UTF-8
Python
false
false
232
py
from os import remove target_file = 'Dn3CV3EUcAETK63_Copy.jpg' k = input('[%s] 파일을 삭제 하겠습니까?(y/n)'%target_file) if k == 'y': remove(target_file) print('[%s]를 삭제했습니다.'%target_file)
[ "noreply@github.com" ]
john911120.noreply@github.com
b50a6aedcddc9733aaad753d771efdeafd33fbcb
fd9dd0b4aea0f55e2b35529462bf5fa7bd4f9d33
/pos_num.py
36afd7e3ff6b919ccdd28b42839a0f21c2ace73d
[]
no_license
mraines4/Python_wk1
833a48f6576cb2130c02516c69a537a1a4e0f158
88bb07b706a67254d795e616412b2baf70217e6c
refs/heads/master
2020-04-23T16:05:43.731860
2019-02-19T20:28:39
2019-02-19T20:28:39
171,286,541
0
0
null
null
null
null
UTF-8
Python
false
false
87
py
numbers = [16, 2, 3, -8, 5, 10] for pos in numbers: if pos > 0: print(pos)
[ "mraines4@DC-MacBook-Air.T-mobile.com" ]
mraines4@DC-MacBook-Air.T-mobile.com
7ad3326cbaca85ab363d12b50eca96bafd2349e9
1fff39c8cffa4b273fa17473d8313f208b111a83
/H1/1.2阶乘求和.py
3904247cb0e12dab18912f52d4f195c1f233d39e
[]
no_license
pkuzhd/Python
9c00c3c2f2969b7349a265ea816ada5df97657d3
54199d1189b4c2458cc525b3b1ad19b645b7c295
refs/heads/master
2021-01-19T08:17:22.440486
2017-04-28T16:25:58
2017-04-28T16:25:58
87,615,592
0
0
null
null
null
null
UTF-8
Python
false
false
225
py
n = int(input()) def factorailSum(n): s = 0 for i in range(1,n+1): m = 1 #m用来记录j的阶乘 for j in range(1,i+1): m *= j s += m return s print(factorailSum(n))
[ "noreply@github.com" ]
pkuzhd.noreply@github.com
c6149ab26615a39e47fb26a9271b478a2d9b3c09
9bd8facfe26300d12661c31272e2f87db36fc0aa
/site-form-works/car_admin/app/models.py
691949186f52019c9dc5660ccad8065e9fe11531
[]
no_license
x350/django
9c75a85ba63ae1c7f7ee0a28b6dfcd73a6d507dc
187dd00fcddb619ff102bf9b3913883774ead565
refs/heads/master
2022-12-07T05:13:54.383754
2019-05-28T21:40:55
2019-05-28T21:40:55
178,067,928
0
0
null
2022-11-22T03:13:37
2019-03-27T20:13:44
Python
UTF-8
Python
false
false
780
py
from django.db import models class Car(models.Model): brand = models.CharField(max_length=50, verbose_name='Бренд') model = models.CharField(max_length=50, verbose_name='Модель') def __str__(self): return self.brand def review_count(self): return Review.objects.filter(car=self).count() review_count.short_description = 'Количество обзоров' brand.admin_order_field = '-id' class Review(models.Model): car = models.ForeignKey(Car, on_delete=models.CASCADE, verbose_name='Машина') title = models.CharField(max_length=100, verbose_name='Название') text = models.TextField() car.admin_order_field = '-id' def __str__(self): return str(self.car) + ' ' + self.title
[ "x350sh@gmail.com" ]
x350sh@gmail.com
feb0a40e60b20afcc8c457b4c5ed4d50a1b52e62
d229e1e9476e53ed5776135d0afdad0a5770d323
/tests/test_topic_stock.py
9a5099b42c01ba49126fb33c2cb6bb820d738626
[ "Apache-2.0" ]
permissive
lukeone/eaiser
5f4cecd8be0a8a888d36477e50cba1117b42e470
9d16b28f9cd5286ebe0da68c38bbedab16b15e68
refs/heads/master
2020-06-19T20:32:30.464830
2019-10-25T02:45:13
2019-10-25T02:45:13
196,861,341
1
0
null
null
null
null
UTF-8
Python
false
false
1,381
py
# -*- coding: utf-8 -*- import pytest from easier.topic.stock import Stock from easier.context import Context @pytest.fixture(scope="module") def topic(): context = Context() topic = Stock(context) context.set_current(topic) yield topic topic.release() @pytest.mark.usefixtures("topic") class TestStock(object): def test_normalize(self, topic): assert topic.normalize("中国平安") == ["601318"] assert topic.normalize(["中国平安"]) == ["601318"] assert sorted(topic.normalize(["中国平安", "000725"])) == sorted(["601318", "000725"]) indexs = topic.normalize(["上证指数", "深圳成指", "沪深300指数", "上证50", "中小板", "创业板"]) indexs_std = ['sh', 'sz', 'hs300', 'sz50', 'zxb', 'cyb'] assert sorted(indexs) == sorted(indexs_std) def test_get_realtime_quotation(self, topic): assert topic.get_realtime_quotation([""]) is None assert len(topic.get_realtime_quotation(["中国平安"])) == 1 assert len(topic.get_realtime_quotation(["中国平安", "000725"])) == 2 def test_get_stock_basis(self, topic): basis = topic.get_stock_basis([""]) assert basis is None or basis.empty assert len(topic.get_stock_basis(["中国平安"])) == 1 assert len(topic.get_stock_basis(["中国平安", "000725"])) == 2
[ "luo86106@gmail.com" ]
luo86106@gmail.com
3462cfff2ec738dd09b64149bfc88294d07a1c38
b73106d844259b2ba4dc0d4c3177fdd5ee65457d
/run_all.py
ef1251a7f7aba7a93dc02c6b53834f0c2966a527
[]
no_license
narendra-ism/task
445764b044608848af6e134d76db0218337d301e
f4dfb3bb9bd0eac15f39e7414e7aa4a05704e4d1
refs/heads/master
2022-12-11T09:10:12.769150
2019-11-05T08:02:19
2019-11-05T08:02:19
218,512,728
0
0
null
2022-12-07T20:30:42
2019-10-30T11:33:32
Python
UTF-8
Python
false
false
653
py
import os import time print('zookeeper is starting') a=['./confluent-4.1.0/bin/zookeeper-server-start -daemon ./confluent-4.1.0/etc/kafka/zookeeper.properties'] os.system(a[0]) time.sleep(10) print('zookeeper is running') print('') print('kafka is starting') b=['./confluent-4.1.0/bin/kafka-server-start -daemon ./confluent-4.1.0/etc/kafka/server.properties'] os.system(b[0]) time.sleep(10) print('kafka is running') print('') print('create a topic in kafka: mytopic') d=['./confluent-4.1.0/bin/kafka-topics --zookeeper 127.0.0.1:2181 --create --replication-factor 1 --partitions 1 --topic mytopic'] os.system(d[0]) time.sleep(5) print('')
[ "narendra11d@gmail.com" ]
narendra11d@gmail.com
f3f977c51021182dec91d0c3e0df7f9325e5120d
bb7aa6e986d8371b65649ebf72eecd79a98eb465
/pset7/houses/import.py
e620753627cdf16dd8cd7b6072c1fd224a1bf264
[]
no_license
brendonn40/CS50
35253f9ab4cb9a9ea07f7099a10d5ed0e4f6fc76
c99536dd935330ba61afa3617c25504216b59403
refs/heads/master
2022-04-13T20:38:25.995614
2020-04-09T14:20:05
2020-04-09T14:20:05
242,616,328
0
0
null
null
null
null
UTF-8
Python
false
false
926
py
from csv import DictReader from sys import argv,exit from cs50 import SQL open(f"students.db", "w").close() db = SQL("sqlite:///students.db") if len(argv)!= 2: print("Usage python import.py file.csv") exit(1) db.execute("CREATE TABLE students (id INT , first TEXT, middle TEXT, last TEXT, house TEXT,birth NUMERIC,PRIMARY KEY(id))") id=1 with open (argv[1],"r") as characters: reader = DictReader(characters) for row in reader: names = row["name"].split() house = row["house"] birth = row["birth"] if len(names) == 3: db.execute("INSERT INTO students (id, first , middle , last , house ,birth) VALUES(?, ?, ?, ?,?,?)",id,names[0],names[1],names[2],house,birth) id+=1 else: db.execute("INSERT INTO students (id , first , middle , last , house ,birth) VALUES(?, ?, ?, ?,?,?)",id,names[0],None,names[1],house,birth) id+=1
[ "noreply@github.com" ]
brendonn40.noreply@github.com
7ce4ab6fcd870ee1929d1564be706a340aae55da
652121d51e6ff25aa5b1ad6df2be7eb341683c35
/examples/e2cylinder.py
e6cfcdcb96ff792080e988aeadbefe32b8a3509e
[]
no_license
jgalaz84/eman2
be93624f1c261048170b85416e517e5813992501
6d3a1249ed590bbc92e25fb0fc319e3ce17deb65
refs/heads/master
2020-04-25T18:15:55.870663
2015-06-05T20:21:44
2015-06-05T20:21:44
36,952,784
2
0
null
null
null
null
UTF-8
Python
false
false
7,482
py
#!/usr/bin/env python ''' ==================== Author: Jesus Galaz - 02/March/2013, Last update: 29/October/2014 ==================== # This software is issued under a joint BSD/GNU license. You may use the # source code in this file under either license. However, note that the # complete EMAN2 and SPARX software packages have some GPL dependencies, # so you are responsible for compliance with the licenses of these packages # if you opt to use BSD licensing. The warranty disclaimer below holds # in either instance. # # This complete copyright notice must be included in any revised version of the # source code. Additional authorship citations may be added, but existing # author citations must be preserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 2111-1307 USA ''' from EMAN2 import * def main(): usage = """Program to generate a cylindrical mask. It can also create a cylindrical shell if you specify the --height_inner and --radius_inner parameters, in addition to the required outer --height and --radius. """ parser = EMArgumentParser(usage=usage,version=EMANVERSION) parser.add_argument("--path",type=str,default=None,help="""Directory to store results in. The default is a numbered series of directories containing the prefix 'cylmask'; for example, cylmask_02 will be the directory by default if 'cylmask_01' already exists.""") parser.add_argument("--verbose", "-v", help="""verbose level [0-9], higner number means higher level of verboseness. Default=0.""",dest="verbose", action="store", metavar="n",type=int, default=0) parser.add_argument("--ppid", type=int, help="""Set the PID of the parent process, used for cross platform PPID""",default=-1) parser.add_argument("--height", type=int, default=0,help="""Height of the cylindrical mask.""") parser.add_argument("--heightinner", type=int, default=0,help="""Height for the inner boundary if creating a cylindrical shell mask.""") parser.add_argument("--radius",type=int,default=0,help="""Radius of the cylindrical mask. Default=boxsize/2.""") parser.add_argument("--radiusinner",type=int,default=0,help="""Radius for the inner boundary if creating a cylindrical shell mask. Default=boxsize/2.""") parser.add_argument("--boxsize", type=int, default=0,help="""Size of the boxsize where the cylindrical mask will live.""") parser.add_argument("--axes",type=str,default='z',help="""Axes along which the mask will be oriented. Default=z. You can supply more than one, separated with commas. For example: --axes=x,y,z.""") parser.add_argument("--rotation",type=str,default='',help="""Three comma separated Euler angles az,alt,phi, to rotate the masks by before writing them out.""") parser.add_argument("--translation",type=str,default='',help="""Three comma separated coordinates x,y,z, to translate the masks by before writing them out.""") parser.add_argument("--rotavg",action='store_true',default=False,help="""This will compute the rotational average of the mask(s) in addition to writing the cylindrical mask itself out.""") (options, args) = parser.parse_args() if not options.boxsize: print "You must provide --boxsize > 4" sys.exit(1) elif options.boxsize < 5: print "You must provide --boxsize > 4" sys.exit(1) if options.heightinner and not options.radiusinner: print "If specifying --heightinner, you must also specify --radiusinner." sys.exit(1) if options.radiusinner and not options.heightinner: print "If specifying --radiusinner, you must also specify --heightinner." sys.exit(1) from e2spt_classaverage import sptmakepath options = sptmakepath( options, 'cylmask') logger = E2init(sys.argv, options.ppid) axes = options.axes.split(',') print "After splitting, axes=", axes #axisdict ={} #for axis in axes: # axisdict.update( { 'z } ) ts = {} mask = cylinder(options) rt=Transform() if options.rotation or options.translation: az=alt=phi=xc=yc=zc=0 if options.rotation: angles=options.rotation.split(',') az=float(angles[0]) alt=float(angles[1]) phi=float(angles[2]) if options.translation: trans=options.translation.split(',') xc=float(trans[0]) yc=float(trans[1]) zc=float(trans[2]) rt=Transform({'type':'eman','az':az,'alt':alt,'phi':phi,'tx':xc,'ty':yc,'tz':zc}) mask.transform( rt ) for axis in axes: print "axis is", axis if 'z' in axis or 'Z' in axis: tz = Transform({'type':'eman','az':0,'alt':0,'phi':0}) print "added z transform" ts.update({'z':tz}) if 'x' in axis or 'X' in axis: tx = Transform({'type':'eman','az':0,'alt':90,'phi':90}) ts.update({'x':tx}) print "added x transform" if 'y' in axis or 'Y' in axis: ty = Transform({'type':'eman','az':0,'alt':90,'phi':0}) ts.update({'y':ty}) print "added y transform" masknamebase = options.path + '/cylmask.hdf' for a in ts: maskt = mask.copy() tag = 'R'+str( options.radius ).zfill( len( str( options.radius))) + 'H'+str( options.height ).zfill( len( str( options.radius))) if options.radiusinner: tag+='RI'+str( options.radiusinner ).zfill( len( str( options.radius))) if options.heightinner: 'HI'+str( options.height ).zfill( len( str( options.radius))) if a == 'z': maskz=mask.copy() maskname=masknamebase.replace('.hdf','_Z_') + tag + '.hdf' maskz.transform( ts[a] ) maskz.write_image( maskname, 0 ) if options.rotavg: rotavgname = maskname.replace('.','_ROTAVG.') maskzrotavg = maskz.rotavg_i() maskzrotavg.write_image( rotavgname , 0 ) if a == 'x': maskx=mask.copy() maskx.transform( ts[a] ) maskname=masknamebase.replace('.hdf','_X_') + tag + '.hdf' maskx.write_image( maskname, 0 ) if options.rotavg: rotavgname = maskname.replace('.','_ROTAVG.') maskxrotavg = maskx.rotavg_i() maskxrotavg.write_image( rotavgname , 0 ) if a == 'y': masky=mask.copy() masky.transform( ts[a] ) maskname=masknamebase.replace('.hdf','_Y_') + tag + '.hdf' masky.write_image( maskname, 0 ) if options.rotavg: rotavgname = maskname.replace('.','_ROTAVG.') maskyrotavg = masky.rotavg_i() maskyrotavg.write_image( rotavgname , 0 ) E2end(logger) return def cylinder( options ): box = options.boxsize mask = EMData( box, box, box) mask.to_one() if options.radius: radius = options.radius else: radius = box/2.0 if options.height: height = options.height else: height = box/2.0 maskout = mask.process("testimage.cylinder",{'height':height,'radius':radius}) finalmask = maskout if options.heightinner and options.radiusinner: maskin = mask.process("testimage.cylinder",{'height':options.heightinner,'radius':options.radiusinner}) finalmask = maskout - maskin return finalmask if __name__ == '__main__': main()
[ "jgalaz@gmail.com" ]
jgalaz@gmail.com
387dabd782ce5ff9ef6a24211f7525578847f816
ee8c4c954b7c1711899b6d2527bdb12b5c79c9be
/assessment2/amazon/run/core/controllers/dull.py
fe0bc212a62abe4ede34e4e1fbbd1c7e1de2186d
[]
no_license
sqlconsult/byte
02ac9899aebea4475614969b594bfe2992ffe29a
548f6cb5038e927b54adca29caf02c981fdcecfc
refs/heads/master
2021-01-25T14:45:42.120220
2018-08-11T23:45:31
2018-08-11T23:45:31
117,135,069
0
0
null
null
null
null
UTF-8
Python
false
false
362
py
#!/usr/bin/env python3 from flask import Blueprint, Flask, render_template, request, url_for controller = Blueprint('dull', __name__, url_prefix='/dull') # @controller.route('/<string:title>', methods=['GET']) # def lookup(title): # if title == 'Republic': # TODO 2 # return render_template('republic.html') # TODO 2 # else: # pass
[ "sqlconsult@hotmail.com" ]
sqlconsult@hotmail.com
0823c8bea45494d2905b0e5043439fae6e53ae03
1a7c7b6785ba275bad55ea24fc4ab82b7344adb6
/Mission_to_Mars.py
936f9d67e310d88cfa51161be42bb3770f219ab6
[]
no_license
nicbrownrigg/Mission-to-Mars
2565ad86102880448073daf4c55d13af539f9746
f9517b8df7d0decf452ada1906d386e682db2d89
refs/heads/main
2023-07-18T10:12:58.761635
2021-08-23T03:52:27
2021-08-23T03:52:27
398,953,092
0
0
null
null
null
null
UTF-8
Python
false
false
2,383
py
# Import Splinter, BeautifulSoup, and Pandas from splinter import Browser from bs4 import BeautifulSoup as soup import pandas as pd from webdriver_manager.chrome import ChromeDriverManager from flask import Flask, render_template, redirect, url_for from flask_pymongo import PyMongo import scraping # Set up Splinter executable_path = {'executable_path': ChromeDriverManager().install()} browser = Browser('chrome', **executable_path, headless=False) app = Flask(__name__) # Visit the Mars news site url = 'https://redplanetscience.com/' browser.visit(url) # Optional delay for loading the page browser.is_element_present_by_css('div.list_text', wait_time=1) # Convert the browser html to a soup object and then quit the browser html = browser.html news_soup = soup(html, 'html.parser') slide_elem = news_soup.select_one('div.list_text') slide_elem.find('div', class_='content_title') # Use the parent element to find the first a tag and save it as `news_title` news_title = slide_elem.find('div', class_='content_title').get_text() news_title # Use the parent element to find the paragraph text news_p = slide_elem.find('div', class_='article_teaser_body').get_text() news_p # ## JPL Space Images Featured Image # Visit URL url = 'https://spaceimages-mars.com' browser.visit(url) # Find and click the full image button full_image_elem = browser.find_by_tag('button')[1] full_image_elem.click() # Parse the resulting html with soup html = browser.html img_soup = soup(html, 'html.parser') # find the relative image url img_url_rel = img_soup.find('img', class_='fancybox-image').get('src') img_url_rel # Use the base url to create an absolute url img_url = f'https://spaceimages-mars.com/{img_url_rel}' img_url # ## Mars Facts df = pd.read_html('https://galaxyfacts-mars.com')[0] df.head() df.columns=['Description', 'Mars', 'Earth'] df.set_index('Description', inplace=True) df df.to_html() browser.quit() # Use flask_pymongo to set up mongo connection app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app" mongo = PyMongo(app) @app.route("/") def index(): mars = mongo.db.mars.find_one() return render_template("index.html", mars=mars) @app.route("/scrape") def scrape(): mars = mongo.db.mars mars_data = scraping.scrape_all() mars.update({}, mars_data, upsert=True) return redirect('/', code=302) if __name__ == "__main__": app.run()
[ "noreply@github.com" ]
nicbrownrigg.noreply@github.com
bf842dabd136a3c999d9455ac2d5af0d645e01d4
f231fd7cb34b042a91addf2e96468cc08ab785e3
/courses/MITx/MITx 6.86x Machine Learning with Python-From Linear Models to Deep Learning/project2/mnist/part1/softmax.py
a457fb19cff54403aa402ebf63b391387f635ffd
[ "Apache-2.0" ]
permissive
xunilrj/sandbox
f1a0d7a1af536bea217bc713e748f04819c2480b
d65076ba487b8bf170368c9e0a0d23e0575fc09f
refs/heads/master
2023-05-10T09:27:59.541942
2023-04-26T15:39:25
2023-04-26T15:39:25
64,613,121
8
5
Apache-2.0
2023-03-07T01:57:24
2016-07-31T20:12:02
C++
UTF-8
Python
false
false
7,347
py
import sys sys.path.append("..") import utils from utils import * import numpy as np import matplotlib.pyplot as plt import scipy.sparse as sparse def augment_feature_vector(X): """ Adds the x[i][0] = 1 feature for each data point x[i]. Args: X - a NumPy matrix of n data points, each with d - 1 features Returns: X_augment, an (n, d) NumPy array with the added feature for each datapoint """ column_of_ones = np.zeros([len(X), 1]) + 1 return np.hstack((column_of_ones, X)) def compute_probabilities(X, theta, temp_parameter): """ Computes, for each datapoint X[i], the probability that X[i] is labeled as j for j = 0, 1, ..., k-1 Args: X - (n, d) NumPy array (n datapoints each with d features) theta - (k, d) NumPy array, where row j represents the parameters of our model for label j temp_parameter - the temperature parameter of softmax function (scalar) Returns: H - (k, n) NumPy array, where each entry H[j][i] is the probability that X[i] is labeled as j """ Xt = np.transpose(X) theta_xt = (theta @ Xt) / temp_parameter c = np.amax(theta_xt, axis=0) exps = np.exp(theta_xt - c) normalization = 1 / np.sum(exps, axis=0) return normalization * exps def compute_cost_function(X, Y, theta, lambda_factor, temp_parameter): """ Computes the total cost over every datapoint. Args: X - (n, d) NumPy array (n datapoints each with d features) Y - (n, ) NumPy array containing the labels (a number from 0-9) for each data point theta - (k, d) NumPy array, where row j represents the parameters of our model for label j lambda_factor - the regularization constant (scalar) temp_parameter - the temperature parameter of softmax function (scalar) Returns c - the cost value (scalar) """ with np.errstate(over='ignore',invalid='ignore',divide='ignore'): logs = np.log(compute_probabilities(X, theta, temp_parameter)) return -np.average( np.where( np.logical_or(np.isinf(logs), np.isnan(logs)), 0, logs ) ) + lambda_factor/2 * np.sum(theta * theta) def run_gradient_descent_iteration(X, Y, theta, alpha, lambda_factor, temp_parameter): """ Runs one step of batch gradient descent Args: X - (n, d) NumPy array (n datapoints each with d features) Y - (n, ) NumPy array containing the labels (a number from 0-9) for each data point theta - (k, d) NumPy array, where row j represents the parameters of our model for label j alpha - the learning rate (scalar) lambda_factor - the regularization constant (scalar) temp_parameter - the temperature parameter of softmax function (scalar) Returns: theta - (k, d) NumPy array that is the final value of parameters theta """ n = X.shape[0] k = theta.shape[0] M = sparse.coo_matrix(([1]*n, (Y, range(n))), shape=(k,n)).toarray() p = np.where(M,1,0) - compute_probabilities(X, theta, temp_parameter) grad = (-1/(temp_parameter*n) * p.dot(X)) + (lambda_factor*theta) return theta - alpha*grad def update_y(train_y, test_y): """ Changes the old digit labels for the training and test set for the new (mod 3) labels. Args: train_y - (n, ) NumPy array containing the labels (a number between 0-9) for each datapoint in the training set test_y - (n, ) NumPy array containing the labels (a number between 0-9) for each datapoint in the test set Returns: train_y_mod3 - (n, ) NumPy array containing the new labels (a number between 0-2) for each datapoint in the training set test_y_mod3 - (n, ) NumPy array containing the new labels (a number between 0-2) for each datapoint in the test set """ return (np.mod(train_y,3),np.mod(test_y,3)) def compute_test_error_mod3(X, Y, theta, temp_parameter): """ Returns the error of these new labels when the classifier predicts the digit. (mod 3) Args: X - (n, d - 1) NumPy array (n datapoints each with d - 1 features) Y - (n, ) NumPy array containing the labels (a number from 0-2) for each data point theta - (k, d) NumPy array, where row j represents the parameters of our model for label j temp_parameter - the temperature parameter of softmax function (scalar) Returns: test_error - the error rate of the classifier (scalar) """ pred_Y = get_classification(X, theta, temp_parameter) pred_Y = np.mod(pred_Y, 3) return np.average(np.where(pred_Y == Y, 0, 1)) def softmax_regression(X, Y, temp_parameter, alpha, lambda_factor, k, num_iterations): """ Runs batch gradient descent for a specified number of iterations on a dataset with theta initialized to the all-zeros array. Here, theta is a k by d NumPy array where row j represents the parameters of our model for label j for j = 0, 1, ..., k-1 Args: X - (n, d - 1) NumPy array (n data points, each with d-1 features) Y - (n, ) NumPy array containing the labels (a number from 0-9) for each data point temp_parameter - the temperature parameter of softmax function (scalar) alpha - the learning rate (scalar) lambda_factor - the regularization constant (scalar) k - the number of labels (scalar) num_iterations - the number of iterations to run gradient descent (scalar) Returns: theta - (k, d) NumPy array that is the final value of parameters theta cost_function_progression - a Python list containing the cost calculated at each step of gradient descent """ X = augment_feature_vector(X) theta = np.zeros([k, X.shape[1]]) cost_function_progression = [] for i in range(num_iterations): cost_function_progression.append(compute_cost_function(X, Y, theta, lambda_factor, temp_parameter)) theta = run_gradient_descent_iteration(X, Y, theta, alpha, lambda_factor, temp_parameter) return theta, cost_function_progression def get_classification(X, theta, temp_parameter): """ Makes predictions by classifying a given dataset Args: X - (n, d - 1) NumPy array (n data points, each with d - 1 features) theta - (k, d) NumPy array where row j represents the parameters of our model for label j temp_parameter - the temperature parameter of softmax function (scalar) Returns: Y - (n, ) NumPy array, containing the predicted label (a number between 0-9) for each data point """ X = augment_feature_vector(X) probabilities = compute_probabilities(X, theta, temp_parameter) return np.argmax(probabilities, axis = 0) def plot_cost_function_over_time(cost_function_history): plt.plot(range(len(cost_function_history)), cost_function_history) plt.ylabel('Cost Function') plt.xlabel('Iteration number') plt.show() def compute_test_error(X, Y, theta, temp_parameter): error_count = 0. assigned_labels = get_classification(X, theta, temp_parameter) return 1 - np.mean(assigned_labels == Y)
[ "1985.daniel@gmail.com" ]
1985.daniel@gmail.com
976b1c3cf14d08fa85ce19b565a2bd70f48d89c9
12c66f064758507068d7cd9e97819fc20105407a
/src/add_cilin.py
355241c1e979461be43a943aa55c69dbedb9cb48
[]
no_license
whr94621/synextractor
64b34b0f6187bb0fc0bbae602298663da4c2f2f1
aa9fc786720a0113b01edd89cb5524029aa42421
refs/heads/master
2020-12-25T06:47:55.744622
2016-07-20T07:25:09
2016-07-20T07:25:09
63,651,121
12
2
null
null
null
null
UTF-8
Python
false
false
1,296
py
# -*- coding: utf-8 -*- """ Created on Tue Jul 19 09:02:18 2016 @author: whr94621 """ import tensorflow as tf from synonym import Synonym ################## # mutable params # ################## top = 15 conf1 = 'configure.json' conf2 = 'configure_1.json' cilin = '../data/cilin.txt' # the script g1 = tf.Graph() g2 = tf.Graph() with g1.as_default(): syn1 = Synonym.load(conf1) with g2.as_default(): syn2 = Synonym.load(conf2) with open(cilin, 'r') as f, open('output.txt', 'w') as g: for line in f: line = line.strip().decode('utf8') words = line.split()[1:] tag = line.split()[0] more_syns = set(words) for word in words: with g1.as_default(): syns1 = syn1.generate_synonyms(word, top) with g2.as_default(): syns2 = syn2.generate_synonyms(word, top) if syns1 and syns2: syns_1 = syns1.values()[0] syns_2 = syns2.values()[0] syns_1 = [w.split('_')[0] for w in syns_1] syns_2 = [w.split('_')[0] for w in syns_2] syns = set(syns_1) & set(syns_2) more_syns = more_syns | syns new_line = '%s %s\n' % (tag, ' '.join(more_syns)) g.write(new_line.encode('utf8'))
[ "whr94621@163.com" ]
whr94621@163.com
75456499fe4c49df64a6eb1cc9eb3dc3a1039719
7dcb63e13c287ea5701840b22067b4d0302e2293
/User/urls.py
a35aa43aa926bf93acbf8043da7b60180ac48e78
[]
no_license
dpitkevics/Jooglin
a09fea1206591933631066ed230cfdeaa5573dc2
ed7f6b78caf71ef446a1207a96cb30e7c2d767d9
refs/heads/master
2021-01-10T13:03:15.411244
2015-04-20T15:22:29
2015-04-20T15:22:29
32,028,245
0
0
null
2015-03-30T14:11:25
2015-03-11T16:24:54
Python
UTF-8
Python
false
false
287
py
from django.conf.urls import patterns, url from User import views urlpatterns = patterns('', url(r'^login$', views.login, name='login'), url(r'^get-balance/$', views.get_balance, name='get_balance'), url(r'^get-experience/$', views.get_experience, name='get_experience'), )
[ "daniels.pitkevics@gmail.com" ]
daniels.pitkevics@gmail.com
435ac96107cd1300a5af9e79f7ec2474327ca74e
bbfaa2609b0a9775e89eaf261b5fa8a5b20445e0
/backend/manage.py
86ecd51d3529074253b3b121308e4264df0aa7cf
[]
no_license
crowdbotics-apps/in-the-mix-20320
9f8921718d9298154adc8278c04b25a9f7f8761b
a8e283776f3fb50049ddb830573e1cf0cfbfb743
refs/heads/master
2022-12-25T02:49:13.689263
2020-09-16T00:36:46
2020-09-16T00:36:46
295,881,723
0
0
null
null
null
null
UTF-8
Python
false
false
636
py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "in_the_mix_20320.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == "__main__": main()
[ "team@crowdbotics.com" ]
team@crowdbotics.com
a828c1cbad38ff9441e7096e89181cbdb0003fd5
e16d86ae86e338a8091c9adeead4df5fe0451e0c
/fetcher.py
68b7e69b37536e5d27ba1baa5b3b8608ece4f0a2
[]
no_license
nekyian/xbmc-suggester
6e40cf69268807637d096a5f3a0452bb8f17e8f1
6bfc5a5513634a64869bbb17321dc1b23062f7e2
refs/heads/master
2020-05-07T11:16:34.029906
2013-04-20T11:33:03
2013-04-20T11:33:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
901
py
#!/usr/bin/python # Import XBMC module import xbmc # First we need to create an object containing the getMusicInfoTag() class from XBMC.Player(). # This is in order to use the same instance of the class twice and not create a new class # for every time we query for information. # This is a bit important to notice, as creating many instances is rarely # a good thing to do (unless you need it, but not in this case). tag = xbmc.Player().getMusicInfoTag() # Now tag contains the getMusicInfoTag() class which then again contains song information. # Now we use this object to get the data by calling functions within that class: artist = tag.getArtist() title = tag.getTitle() # Now you have two strings containing the information. An example of what you could do next is to print it: print "Playing: " + artist + " - " + title # This will produce i.e: "Playing: AC/DC - Back in black"
[ "dan.stativa@gmail.com" ]
dan.stativa@gmail.com
a8dbb51ef0ca26def134a3942bb8d2f0822cf411
2836013e948f89165a0de1ed3feaf262f3a3a1f0
/models/TextCNN_PGD.py
ff675206b4786a47ab9278fa4cdee3b413ee50d5
[ "MIT" ]
permissive
zpyzl/adversarial
66be9d48b884af1417c8f42122338ea4c193bb96
2a0376e5691c00ff39f5dd3fb496e544c39cb0e8
refs/heads/master
2023-03-09T17:13:28.819692
2021-03-03T01:57:43
2021-03-03T01:57:43
336,278,967
0
0
null
null
null
null
UTF-8
Python
false
false
3,612
py
# coding: UTF-8 import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from utils import clamp, add_perturbed_labels class Config(object): """配置参数""" def __init__(self, dataset, embedding): self.model_name = 'TextCNN' self.train_path = dataset + '/data/train.txt' # 训练集 self.dev_path = dataset + '/data/dev.txt' # 验证集 self.test_path = dataset + '/data/test.txt' # 测试集 self.class_list = [x.strip() for x in open( dataset + '/data/class.txt', encoding='utf-8').readlines()] # 类别名单 self.vocab_path = dataset + '/data/vocab.pkl' # 词表 self.save_path = dataset + '/saved_dict/' + self.model_name + '.ckpt' # 模型训练结果 self.log_path = dataset + '/log/' + self.model_name self.embedding_pretrained = torch.tensor( np.load(dataset + '/data/' + embedding)["embeddings"].astype('float32'))\ if embedding != 'random' else None # 预训练词向量 self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # 设备 self.dropout = 0.5 # 随机失活 self.require_improvement = 1000 # 若超过1000batch效果还没提升,则提前结束训练 self.num_classes = len(self.class_list) # 类别数 self.n_vocab = 0 # 词表大小,在运行时赋值 self.num_epochs = 20 # epoch数 self.batch_size = 128 # mini-batch大小 self.pad_size = 32 # 每句话处理成的长度(短填长切) self.learning_rate = 1e-3 # 学习率 self.embed = self.embedding_pretrained.size(1)\ if self.embedding_pretrained is not None else 300 # 字向量维度 self.filter_sizes = (2, 3, 4) # 卷积核尺寸 self.num_filters = 256 # 卷积核数量(channels数) '''Convolutional Neural Networks for Sentence Classification''' class Model(nn.Module): def __init__(self, config): super(Model, self).__init__() if config.embedding_pretrained is not None: self.embedding = nn.Embedding.from_pretrained(config.embedding_pretrained, freeze=False) else: self.embedding = nn.Embedding(config.n_vocab, config.embed, padding_idx=config.n_vocab - 1) self.convs = nn.ModuleList( [nn.Conv2d(1, config.num_filters, (k, config.embed)) for k in config.filter_sizes]) self.dropout = nn.Dropout(config.dropout) self.fc = nn.Linear(config.num_filters * len(config.filter_sizes), config.num_classes) def conv_and_pool(self, x, conv): x = F.relu(conv(x)).squeeze(3) x = F.max_pool1d(x, x.size(2)).squeeze(2) return x def forward(self, x, labels): out = self.embedding(x[0]) out = out.unsqueeze(1) out = torch.cat([self.conv_and_pool(out, conv) for conv in self.convs], 1) out = self.dropout(out) out = self.fc(out) loss = F.cross_entropy(out, labels) return out, loss
[ "zpyzl@qq.com" ]
zpyzl@qq.com